Skip to main content

Full text of "Syntax Magazine"

See other formats


-  SOLVE  12  CLUES  LIKE  THIS!  - * 

Where  it  all  began.  Where  the  torch  was  first  lit. 
Where  muscles  and  sinews  strain.  Where  our  heros 
win  acclaim.  Where  the  symbols  hold  the  key. 


KRAKIT”  consists  of  12  clues  on  a  ready-to-run  ZX81  or  TS1000 
cassette  tape  (16k  RAM).  The  answer  to  each  clue  is  the  name  of  a 
country,  a  city  or  town,  and  a  number.  If  you  are  the  first  qualified 
entrant  to  solve  all  12  clues  and  declared  the  winner,  you  receive  two 
tickets  to  the  city  of  the  secret  KRAKIT"  vault  location.  When  you  arrive 
at  that  location,  a  check  for  a  minimum  amount  of  $20,000.00  (U.S.)  will 
be  presented  to  you.  The  amount  of  the  prize  money  is  augmented  weekly 

TS1000-ZX81 


Mail  to: 

INTERNATIONAL  PUBLISHING  &  SOFTWARE  INC 
P  O  ROT  BUFFALO,  N.Y.  14216 


'>€»* 


SYNTAX  QUARTERLY/SPRING  1983 


A  PUBLICATION  OF 

THE  HARVARD  GROUP 


SYNTAX  QUARTERLY 

Serving  The  Timex-Sinclair  Family  of  Personal  Computers 


Spring  1983 


Vol.  2,  No.  1 


Contents 


SQ  Staff 


Publisher 

Kirtland  H.  Olson,  P.E. 

Editor 

Ann  L.  Zevnik 

Assistant  Editor 

Pamela  Petrakos-Wilson 

Technical  Consultant 

Eric  K.  Olson 

Editorial  Assistants 

Pamela  K.  Vinal 
Karen  Brody 

Production 

CSA  Press 

Circulation 

Susan  C.  Shippen 
Constance  Saarinen 
Timothy  Parker 

Financial  Manager 

Mary  Russo 

Designer 

RDS  Designs 

Cover  Photography 

James  Rue  Design 


Syncwars — An  Invasion  1 4 

The  invasion  of  Computerburg.  by  Fred  Nachbaur 

Geography  Review— U.S.  States  Quiz  19 

A  review  of  U.S.  geography,  by  Steven  Walley 

POKEing  Directly  to  the  Display  File  22 

Use  less  memory,  speed  up  graphics,  by  Dan  Platt 

Simultaneous  Linear  Equations  and 
Matrix  Inversion  24 

Solve  equations  and  invert  matrices  with  this 
program— a  delight  for  amateur  mathematicians, 
by  R.A.  Woodall 

ZX/  TS  Home  Budget  26 

Home  finances  on  your  personal  computer, 
by  Michael  Roberts 

Getting  Your  Head  Straight  3  0 

Align  the  heads  on  your  recorder,  by  John  Andrews 

Make-It- Yourself  Quiz  Program  34 

Choose  your  format,  tailor  questions  and  answers, 
by  Dale  F.  Lipinski 

Build  Your  Own  EPROM  Programmer 
and  Centronics  Printer  Interface— 

Part  II  38 


Build  2  EPROM  read  boards  and  a  2-way  Centronics  compatible 
parallel  printer  port  with  step-by-step  instructions, 
by  John  Oliger 

Operation  Codes  of  the  8080,  8085 

and  Z80  Processors  46 

A  complete  reference  to  the  op-code  mnemonics 
of  8080,  8085  and  Z80  microprocessors, 
by  D  Martin  Flarrell 


Departments 


4 


s' BASIC 

8 

Reviews 

54 

Reviews 

57 

ws 

61 

64 

SYNTAX  QUARTERLY/SPRING  1983 


This  Could  be  Your  Chance 
for  Fame  and  Fortune 

(or  at  least  fame) 

Would  you  like  to  see  your  name  in  programming  tip,  explain  the  func- 
print?  SQ  and  SYNTAX  newsletter  tion  of  the  machine  or  a  command,  or 
are  looking  for  authors.  If  you  have  a  describe  a  hardware  project.  If  you 
program  or  article  you  d  like  to  share  present  ideas  on  programming,  it 
with  other  ZX/TS  owners,  send  it  helps  to  include  short  sample  routines 
a*on9-  demonstrating  your  ideas.  If  your 

Our  requirements  are  simple:  all  article  discusses  hardware,  please  in- 
we  ask  is  that  your  program  run  with  elude  sketches,  schematics,  or  even 
no  bugs  and  your  article  present  ac-  photos  to  help  readers  follow  along, 
curate  information.  For  both  programs  and  articles, 

However,  here  are  a  few  more  de-  type  your  submission  or  print  clearly' 
tails  that  enhance  your  chances  of  preferably  double-spaced.  Put  your 
being  published:  name,  address  and  day-time  phone 

PROGRAMS:  Any  program  for  a  number  on  the  first  page.  If  you  want 
fun  or  useful  purpose  is  a  candidate  us  to  return  your  material  to  you, 
for  SYNTAX  or  SQ.  We  publish  include  a  self-addressed  stamped 
game,  business,  educational,  utility  envelope. 

and  science/math  programs.  Please  You  can  submit  to  either  SYNTAX 
send  programs  on  cassette,  particu-  newsletter  or  SQ  magazine.  Gener- 
larly  if  they’re  long.  We  print  ally,  programs  and  articles  in  SQ  tend 
programs  directly  from  a  Sinclair  to  be  longer  and  more  involved  than 
printer  to  minimize  errors.  If  you  send  those  in  SYNTAX  because  of  space 
your  program  on  cassette,  it  will  ap-  considerations.  Which  publication 
pear  exactly  as  you  entered  it.  A  your  submission  ultimately  appears  in 
hard,  or  paper,  copy  helps  us  figure  is  up  to  the  editors, 
out  any  problems  that  may  arise .  Also  What’s  in  it  for  you?  Aside  from  the 
include  as  much  documentation  as  fame  and  glory  of  appearing  in 
you  can,  including  a  list  of  variables  SYNTAX  or  SQ,  you’ll  receive  a 
used  and  their  functions.  Write  com-  check  from  us  dependent  on  the 
plete  instructions  for  using  your  length  of  the  published  material.  We 
program  so  the  most  inexperienced  pay  7  cents  for  each  6  characters,  in¬ 
user  could  not  mess  it  up.  Sample  eluding  spaces  and  punctuation.  This 
output  also  helps,  especially  if  your  payment  buys  us  the  nonexclusive 
program  generates  charts,  graphs,  or  right  to  use  your  material.  We  can  use 
numerical  tables.  Make  your  program  it  and  so  can  you,  so  you  can  sell  it 
as  user-friendly  as  possible  within  the  again  to  anyone  you  like.  Programs 
limitations  of  available  memory.  Indi-  receive  a  token  $2  payment  each, 
cate  how  much  memory  your  pro-  Not  enough  to  retire  on,  but  often 
gram  requires.  And  include  the  Syn-  enough  to  pay  for  your  subscription, 
tactic  Sum  of  the  program  as  listed.  So  dig  through  your  notes  and  files 
For  a  copy  of  the  Syntactic  Sum  pro-  and  send  off  anything  you  think  may 
gram,  contact  SYNTAX  (address  help  other  users  use  their  computers 
following).  better.  Address  submissions  to: 

ARTICLES:  Articles  can  cover  vir¬ 
tually  any  topic  related  to  ZX/TS  Editor 

computers  and  their  applications.  SYNTAX/SQ 

Our  readers  run  the  gamut  from  ex-  Rd  2,  Box  457 

pert  to  novice,  so  we  are  looking  for  Harvard,  MA  01451 

articles  written  at  all  levels  of  com-  USA 

plexity.  Your  article  can  present  a 


$5.95 

8%"  x  11”  credit-card-type-plastic 
MICRO  CHARTS  are  fact-packed 
microprocessor  summary  cards  ... 
that  save  you  time  and  effort  with 
instant  access  to  the  data  you  need. 


Thousands  of  delighted  users  have  made 
the  switch  from  black  &  white, 
incomplete,  folded-up,  paper  summaries 
with  scrambled  data  ...  to  unscrambled, 
comprehensive,  ready-to-use  MICRO 
CHARTS. 


Two  sided  colorful  MICRO  CHARTS  are 
ideal  for  professionals,  hobbiests,  and 
students  alike.  Countless  reorders  and 
repeated  praise  confirm  the  benefit  of 
these  inexpensive,  improved  programming, 
debugging  and  learning  aids. 

Buy  one.  Or  the  whole  set.  You’ll  never 
switch  back.  We  guarantee  it.  And  you’ll 
soon  see  that  lifetime  MICRO  CHARTS 
are  worth  much  more  ...  than  the  cost  of  a 
couple  of  hamburgers!  Order  now. 


Syntax  ZX80  Inc.  (617)  456-3661,  Dept. 
1»  RD  2,  Box  457,  Harvard,  MA  01451 
YES,  please  rush  the  MICRO  CHARTS 
indicated  below  at  just  $5.95  each.  Unless 
I  am  100%  pleased  in  14  days,  a  prompt  full 
refund  will  be  made. 


Quan. 

Chart  Title 

Total  Quan 

Z80  CPU 

6502  (65XX) 

Sub  Total 

8080A  &  8085A 

$ 

8048  &  RELATIVES 

Pstg  &  Hndg 

ALGORITHMS 

$1.00 

□  Save  $5.80!  Select  any  5  for 
only  $24.95  postpaid  (10  at 

Total 

Enclosed 

$49.90  etc.).  Same  100%  * 

money  back  guarantee. 


YOUR  NAME 

COMPANY 

ADDRESS  ~ 

city  state  ziF 


SYNTAX  QUARTERLY/SPRING  1983 


■> 


SHIM 


SQ-ups— Winter  82 


Getting  Information  into  Your  Computer  by  Jim  Conrad 
On  p.  6,  column  2,  line  10  of  the  first  example  program 
should  read: 

10  LET  B=  17 

In  the  table  on  p.  8,  under  “Example”  the  third  entry 
should  read  Reserved  Words  (TO,  RUN,  TAN). 

On  p.  9,  column  2,  line  10  should  read: 

10  PRINT  “first  message” 

Improved  Super  Monzxer  Game  by  Robert  Calhoon 
Line  240  should  read: 

240  PLOT  23,21 

The  last  word  in  line  1700  is  correctly  spelled  MONZXER. 
We  apologize  for  incorrectly  spelling  Mr.  Calhoon’s 
name. 

Syntactic  Sum  with  Variables  by  Donald  J.  Beck 
In  the  assembly  listing  on  pp.  18-19,  all  appearances  of 
the  number  16346  should  read  16396  and  all  ap¬ 
pearances  of  the  number  16347  should  read  16397.  The 
instances  occur  at  addresses: 

32720  (mnenonic  and  comment) 

32721  (comment) 

32722  (comment) 

32723  (comment) 

The  code  at  address  32743  should  be  229. 

Machine  Code  Programs  — Where  and  How  to  Load 
Them  by  William  Wentz 

On  page  21,  first  paragraph  under  Variables  Storage 
Area,  the  last  sentence  should  read:  For  ease  in  placing 
the  MC  into  the  string  and  locating  the  USR  address,  put 
the  LET  statement  containing  the  MC  first  in  the  pro¬ 
gram,  so  it  will  be  the  first  variable  in  storage. 

ZX/TS  Directory  Program  by  David  R.  Rowland 
The  variables  in  line  1,  2,  and  3  should  all  be  dimen¬ 
sioned  to  (90,31),  not  (1,31)  to  allow  all  90  entries.  See 
reprinted  listing  following. 

Keyboard  Conversions  by  David  M.  Straub 
In  Figure  1,  p.  27,  every  key  should  have  two  black  dots 
indicating  pins.  Those  in  the  upper  right  corner  are  miss¬ 
ing  one  dot. 

Using  Extra  Keys  on  Big  Keyboard  — A  Simpler  Ap¬ 
proach  by  David  Ornstein 

Please  note  that  the  anode  of  D3  indicated  on  the 
schematic  is  for  a  ZX80.  On  a  ZX81  or  TS1000,  that 
diode  is  D6. 


Build  Your  Own  EPROM  Programmer  and  Centronics 
Printer  Interface  by  John  Oliger 

Except  when  referring  to  ROM  installation  inside  the 
ZX/TS,  Dn  always  means  Dn’  (which  appears  at  the 
edge  connector)  in  parts  I  and  II  of  this  article.  Dn  means 
data  line  n. 

Program  Clarification 

Parts  of  programs  in  SQ  Winter  82  did  not  print  as  clearly 
as  we  would  like.  Here  are  portions  of  those  listings 
reprinted  for  easier  reading. 


A  Program  to  Index  Articles 

1©  DIM 

20  DIM  B$(400,24) 

30  DIM  C$C400, 5) 

30  PRINT  RT  3,3;  “5YNTRX  INDEX*1 
12©  PRINT  RT  9 , 1©; "  1  .  RPPEND" 

13©  PRINT  RT  10,10;  '*2.  LIST" 

14-©  PRU5E  50000 

15©  POKE  154-37,255 

150  IF  INKE*y$  =  "l"  OR  INKEY$="A" 
THEN  GOTO  1000 


220  INPUT  K 

230  IF  K  < 1  OR  K  >6  THEN  GOTO  220 

2 2©  GOTO  K *5© +25© 

250  SCROLL 

250  PRINT  **  «";C$(I);,,-";B$(I) 
255  SCROLL 

27©  PRINT  "  “UOL / ISSUE /  PRGE  ";R 

;  "/“i  5;  C 

272  SCROLL 
275  PROSE  90 

230  IF  INKEY$="P"  THEN  PRUSE  50 
000 

235  POKE  154-37,255 

29©  RETURN 

30©  FOR  1  =  1  TO  4-00 

305  LET  R=INT  C (CODE  R$(I) -1) /I 
2) 

31©  LET  B=CQDE  R$<I*-R*I2 
315  LET  C=CODE  R$  l  1+4-00) 

32©  GO-SUB  250 
325  NEXT  I 


Improved  Super  Monzxer 
The  words  in  reverse  video  are: 

2030  HURRAY  HURRAY 


14-20  PRINT  "THERE  IS  R  SPIDER  IN 
YOUR  ROOM  AND  HE  IS  HUNGRY" 
14-23  PRINT  RT  9.10;  "  K 


14-24-  PRINT  RT 


1©,9;  "i 


14-25  PRINT  RT  11,9;  "1 


14-27  PRINT  RT  I2,I7;"IL  IL  IL" 
14-28  PRINT  RT  1 4-, 7;  "YUM  YUM  ERTE 
M  UP" 

14-29  PRUSE  100 
14-3©  FOR  1=1  TO  10 

14-4-0  IF  YR=P(I)  THEN  GOTO  14-70 
14-5©  NEXT  I 
14-50  GOTO  154-0 

14-70  IF  YL=5  THEN  GOTO  1520 


Continued  Next  Page 


4 


SYNTAX  QUARTERLY/SPRING  1983 


148©  CLS 

1490  PRINT  "T5K,  T  SK ,  YOU  PELL  I 

15©0  LET  YR=YR+20 

X505  XP  YL>=2  THEN  GOTO  154-0 


303© 

304-0 

3050 

3G6G 

3070 

SET  3  * 

3030 

3000 

3100 

3110 

3120 

3130 

314-0 

315© 

3160 

3165 

3170 

350© 

3510 


3520 


3530 

■/" 

3S4-© 

354-2 

354-4- 

354-6 

3550 

3560 


LET  K$=INKEY$ 

XP  K$="Y"  THEN  GOTO  3070 

IP  K$="N"  THEN  GOTO  313© 

GOTO  3020 

PRINT  RT  10,6; “SAME  TUNNEL 

PAUSE  900 
LET  K$=INKEY$ 

XP  K$="Y"  THEN  GOTO  525 

IP  K$="N"  THEN  GOTO  300 

GOTO  3060 
CLS 

PRINT  RT  10,20; "HAR  HRR" 
PRINT  RT  12,18; "YOU  LOSE" 
LET  END=1 
FAST 
GOTO  70 

PRINT  RT  10,9; "TT  TT  TT" 

print  rt  11,8;  "  tHHIHHHHHMHI 

r 

print  rt  12,5;  ■■  >  >=  =  =BBHHHi 
Print  rt  TSSM 

print  rt  14- ,  12; 

PRINT  RT  0,20;  *‘7 
PRINT  RT  7,24;"?" 

PRINT  RT  5,27;"?" 

PRINT  RT  16,22; "YA  GOT  HE" 
RETURN 


10  REM  ®_N  7?E« RND  GOSUB  ???»T 
GuSUB  ??RND  GOSUB  7  POR  ;  GOSUB 
§  GOSUB  ??RNDEi RND  GOSUB  PI6, RN 
DE  "RND  GOSUB  PIS  “RND  GOSUB  ?T  GC 
SUB  PI  RRND  TRN 
2©  LET  H$  =  " 

4-0  LET  L  =LEN  H$^3 
5©  LET  M=L 

6©  IP  L  <20  THEN  LET  M=20 
70  POKE  16507, M 

8©  PRINT  USR  16514-;"  BYTES  SAU 
EL>" 

O0  LET  N=PEEK  16388 +256 +PEEK  1 
6380 

100  PRINT  "RECORD  USR  RDDRESS  " 

'  lie  POR  X  =3  TO  L*3  STEP  3 
120  POKE  N,16*CQDE  H$(X-2)+CODE 
H$  ( X  - 1)  -4-76 
130  LET  N=N  +  1 
140  NEXT  X 

150  PRINT  "  HRCHINE  CODE  LORDED 


SYNTACTIC  SUH: 


£304-4-  ,  8K  ROM 


ZX/TS  Director y  Program 
The  words  in  reverse  video  are: 

62  EVER  AGAIN 

196  MEMORY  FULL 

197  CONT 

455  NONE  FOUND 
457  CONT 
490  CONT 

915  the  Y  in  DIRECTORY 


MC  Programs  — Where  and  How  to  Load  Them 


10  REM 
20  LET 
40  LET 
5©  LET 
6307-2 
6©  POR 
7©  POKE 
80  POKE 
15 

O0  RRND 
100  POKE 
CODE  H$( I 
110  NEXT 
120  POKE 
130  POKE 
20©  REM 
SYNTACTIC 


12EI.RNDLN  I^TAN 

N=LEN "h$/3 

D=PEEK  16306  +256  fPEEK  1 
1=1  TO  N 

16515 , INT  C (D  +  I) /256 3 
lt>514  ,  D  +  1—256  fPEEK  165 

USR  16516 

D  +  I ,  16fCODE  H$  *  1*3-2 >  + 
*3-1) -476 
I 

D  —  1 , INT  C  (N+2)  /256) 

D -2 , N  +2-256  +PEEK  ( D - 1 ) 

SUM:  20307,  SK  ROM 


10  REM 
2©  LET 
40  LET 
5©  LET 
6307-2 
60  POR 
70  POKE 
80  POKE 

15 

O©  RRND 
100  POKE 
4-1) 

110  NEXT 
12©  POKE 
130  POKE 
200  REH 
SYNTACTIC 


12El^NDLN  SafcTRN 
D$=" 

N=LEN  D$/3 

D=PEEK  16306 +256 +PEEK  1 
1=1  TO  N 

16515,  INT  (  (D  +  I)  /256 ) 
16514 ,D+I— 256+PEEK  165 

USR  16516 

D+I, URL  D$ (1*4-3  TO  I* 


D-l , INT  C (N+2) /256 ) 

D -2 , N  +2 -256  *PEEK  ( D - 1 ) 

SUM:  10287,  SK  ROM 


1  DIM  N$ (00.31) 

2  DIM  S$(90,31) 

3  DIM  T$(90,31) 

6  REM  STRRT  PROGRRM  WITH  "GO 
TO  16 " AFTER  INITIAL  RUN 

O  LET  D=0 

10  PRINT  RT  0, 12; "HELLO" ; RT  2, 
l; "ENTER  CODE  POR  UHAT  IS  WANTED 

11  PRINT  RT  4,0; "1.  ENTER  MOR 
E  NAMES” 

12  PRINT  "2-  CHRNGE  SELECTED 

NRME  OR  OTHER  DATR" 

^13  PRINT  "3.  CHECK  RLL  ENTRIE 

14  PRINT  "4.  LIST  RLL  NAMES  B 

EGINNING","  WITH  R  LETTER" 

^  if  PRINT  "5.  LIST  RLL  NRMES  I 
N  STATE " 

16  PRINT  "6.  LIST  RLL  NRMES  N 

OT  IN  STATE"  / 

17  PRINT  "7.  LIST  RLL  NRMES  & 
Y  ZIP  CODE" 

18  PRINT  "8.  LIST  RLL  CODED  N 
AMES" 

IO  PRINT  "O.  SRUE  REUISED  DIR 
ECTORY" 


16©  INPUT  U$ 

165  CLS 

170  IP  U$="Y"  THEN  GOSUB  75© 
X^S^PRINT  RT  ©,©; L, ,N$ (L) ,S$ (L) 

175  PRINT  "RLL  CORRECT?  Y  OR  N 

*  178  INPUT  U$ 

180  IP  U$<>"N"  THEN  GOTO  184 

181  LET  R=1 

182  GOSUB  330 

183  LET  R=© 


Continued  Next  Page 


SYNTAX  QUARTERLY/SPRING  1983 


134-  Cl_S 

135  PRINT  RT  6,0; "ANY  MORE  NRME 

ST  V  OR  N . " 

187  INPUT  U$ 

100  CI_S 

102  XF  U$<>"Y"  THEN  RETURN 

105  NEXT  L. 


34-0  INPUT  Q 

350  XF  Q=1  THEN  INPUT  N$(L) 

355  XF  0=2  THEN  INPUT  S$CL,  TO 

10) 

360  XF  0=3  THEN  INPUT  T$  CL  ,  TO 

10) 

365  XF  0=4-  THEN  INPUT  T$(L.23  T 

O  25) 

378  XF  0=5  THEN  INPUT  T$iL.27  T 

O  31) 

375  XF  0=6  THEN  INPUT  S$U_.2©  T 

O  ) 

330  IF  0=7  THEN  GOSUB  750 

335  IF  0=3  THEN  GOTO  35 
333  IF  0=0  THEN  GOSUB  660 

330  CL5 
305  GOTO  305 

4-00  PRINT  RT  4-,©;  -'ENTER  LETTER  f 
S)  OR  NRME  TO  BE” ."LOCRTED" 

4-©5  LET  0=0 
4- 10  INPUT 
4-20  CLS 

4-3©  FOR  L  =  1  TO  D 

4-4-©  IF  U$=N$CL,  TO  LEN  U$)  THEN 
GOSUB  4-65 
4-50  NEXT  L 

4-55  IF  0=0  THEN  PRINT  RT  7.10;  " 


4-57  PRINT  RT  20.8;  "PRESS  " 

TO  REGRIN  MENU- 
4-60  STOP 
4-62  RETURN 

4-65  PRINT  L,  ,N$(L)  ,S$CL)  ,T$(L)  , 
' 478  LET  0=0+1 

4-30  IF  INT  C0/4-)  =0/4-  THEN  GOTO 
4-9© 

4-85  RETURN 

4-0©  PRINT  RT  20,0;  -PRESS  - 
--  TO  RESUME  LISTING" 

4-02  STOP 
4-05  RETURN 
4-07  GOTO  4-5© 

50©  PRINT  RT  5,©; "ENTER  TUO  LET 
TER  STRTE  CODE- 
505  LET  0=0 
51©  INPUT  U$ 

515  CLS 

52©  FOR  L  =  1  TO  D 

525  IF  U $  =T  $  CL  .  23  TO  24-)  THEN  G 
OSUB  465 
530  NEXT  L 
54-0  GOSUB  4-55 
55©  RETURN 

6©0  PRINT  RT  5,0; "ENTER  TUO  LET 
TER  STRTE  CODE- 
605  LET  0=0 
610  INPUT  U$ 

615  CLS 

620  FOR  L  =1  TO  D 

625  IF  U$oT$(L,23  TO  24-)  THEN 
GOSUB  4-65 
630  NEXT  L 
64-0  GOSUB  4-55 
65©  RETURN 
66©  LET  N$(L) =N$(D) 

665  LET  S$CL)=55MD} 

67©  LET  T$CL) =T$CD) 

675  LET  N$ CD) =  "  " 

660  LET  54(D) =”  " 

685  LET  TiCD)="  " 

60©  LET  D  =D  —  I 
605  RETURN 

70S  PRINT  RT  5.6; "ENTER  5  NUMBE 
R  ZIP” 


S INWARE  provides  high-quality 
machine-code  programs  for  the 
TS1000  or  ZX81. 

HOT  Z 

HOT  Z  is  the  machine-programming 
editor,  debugger  and  disassembler  that 
takes  the  mystery  out  of  assembly  lan¬ 
guage.  Over  40  cursor-driven  com¬ 
mands  give  you  an  interactive  system 
for  entering,  revising  and  relocating 
code.  Full-screen  listings  with  your 
labels  let  you  understand  other  pro¬ 
grams  and  capture  the  power  of  ROM 
routines  for  your  own  programs. 

SQ  said  of  HOT  Z:  ''Easily  the  best 
machine  language  debugging  package 
/  have  ever  seen  for  the  ZX81.  .  .  if  you 
program  in  machine  language  and 
need  the  best  tool  for  the  job ,  buy 
HOT  Z." 

HOT  Z  is  just  $19.95  +  $2.00  pp  on 
cassette  in  different  versions  for  16K  or 
32K  +  .  Please  specify.  NOW  ON 
EPROM  (four  2716's)  mapped  to  the 
8-16K  block  for  the  Hunter  or  similar 
board,  HOT  Z-E  is  $40. 

Z  EXTRA 

Z  EXTRA  is  a  display  creator/con¬ 
troller  that  makes  you  a  master  of  ZX 
graphics  and  displays.  No  program¬ 
ming  is  required  to  create,  save,  print 
or  display  multiple  screens  of  text  and 
graphics.  Z  EXTRA  features  a  full¬ 
screen  editor,  blinking  cursors,  re¬ 
peating  keys,  four  write  directions, 
eight  plot  directions,  4x4  and  8x8  char¬ 
acter  sizes,  and  much  more. 

Z  EXTRA'S  displays  provide  horizontal 
or  vertical  scrolls  of  multiple  screens 
against  a  background  screen,  or  timed 
page  flips  for  simple  animation.  Screens 
can  be  transferred  to  BASIC  strings  to 
save  hours  of  fussy  progamming. 

Z  EXTRA  requries  a  ZX81  or  TS 1000 
with  at  least  16K  of  RAM  and  is  espec¬ 
ially  useful  with  64K.  Just  $19.95  + 
$2.00  pp  on  cassette. 

SINWARE 

BOX  323,  DIXON,  NM  87527 


6 


SYNTAX  QUARTERLY/SPRING  1983 


l 


I 

I 


BEHIND  EVERY 
GOOD  SINCLAIR 
IS  A  MEMOPAK 


If  you  own  a  Timex-Sinclair  1000  or 
ZX81  computer,  you  should  have  a 
Memopak  behind  it.  From  increased 
memory  to  high  resolution  graphics, 
Memotech  has  a  Memopak  to  boost  your 
system’s  capabilities.  Every  Memopak 
peripheral  comes  in  a  black  anodised 
aluminum  case  and  is  designed  to  fit 
together  in  “piggy  back”  fashion  to  enable 
you  to  continue  to  add  on  and  still  keep  an 
integrated  system  look. 


High  Resolution  Graphics 


Order  at  no  risk 

All  Memotech  products  carry  our  10 
day  money  back  guarantee.  If  you’re  not 
completely  satisfied,  return  it  in  ten  days 
and  we  will  give  you  a  full  refund. 

And  every  Memotech  product  comes  with  a 
six  month  warranty.  Should  anything  be 
defective  with  your  Memopak,  return  it  to 
us  and  we  will  repair  or  replace  it  free  of 
charge.  Dealer  inquiries  welcome.  To  order 
any  Memotech  product  call  our  toll-free 
number  800/662-0949  or  use  the  order 
coupon. 


CORPORATION 

7550  West  Yale  Avenue 
Denver,  Colorado  80227 
(303)  986-1516 
TWX  910-320-2917 


1  64K  RAM 

$179-95 

j  32K  RAM 

109  95 

|  16K  RAM 

59  95 

Centronics  Parallel  Printer  Interface 

104.95 

1  RS232  Printer  Interface 

13995 

'  High  Resolution  Graphics 

144.95 

|  Shipping  and  handling 

4.95 

$4.95  1 

.  *  All  prices  quoted  in  U.S.  dollars 
.  **  Colorado  residents  please  add  sales  tax 
!  □  Check  □  MasterCard  □  Visa 

Tax** 

Total 

Account  No. 

F.xn 

j  Name 

j  Address  1 

1  City 

L 

State 

Zip  1 

Memopak  64K  RAM  The  64K  RAM  extends  the 
memory  of  your  Sinclair  by  56K  to  a  full  64K.  It 
is  directly  addressable,  user  transparent,  is 
neither  switched  nor  paged  and  accepts  such 
BASIC  commands  as  10  DIM  A  (9000).  The 
Memopak  64K  turns  your  Sinclair  into  a 
powerful  computer  suitable  for  business, 
recreational  and  educational  use.  No  additional 
power  supply  is  required. 

Memopak  32K  RAM  The  32K  RAM  Memopak 
offers  your  Sinclair  a  full  32K  of  directly 
addressable  RAM.  Like  the  64K  Memopak,  it  is 
neither  switched  nor  paged  and  enables  you  to 
execute  sophisticated  programs  and  store  large 
data  bases.  It  is  also  fully  compatible  with 
Sinclair’s  or  Memotech’s  l6K  RAM  to  give  you  a 
lull  48K  of  RAM. 

Memopak  16K  RAM  The  Memopak  16K  RAM 
provides  an  economical  way  to  increase  the 
capabilities  of  your  Sinclair.  And  at  the  same 
time,  it  enables  you  to  continue  to  add  on  other 
features  with  its  “piggy  back”  connectors.  It  is 
compatible  with  the  Sinclair  16K  or  a  second 
Memopak  16K  or  Memopak  32K  tp  give  32K  or 
48K  of  RAM  respectively. 

Memopak  High  Resolution  Graphics  The 
Memopak  HRG  contains  a  2K  EPROM  monitor 
and  is  fully  programmable  for  high  resolution 
graphics.  The  HRG  provides  for  up  to  192  by  248 
pixel  resolution. 

Memopak  Printer  Interface  The  Memopak 
Centronics  Parallel  or  RS232  Interface 
paks  enable  your  Sinclair  to  use  a  wide  range  of 
compatible  printers  (major  manufacturers’ 
printers  available  through  Memotech  at 
significant  savings).  The  resident  software  in  the 
units  gives  the  ASCII  set  of  characters.  Both 
Memopak  printer  interfaces  provide  lower  case 
character  capabilities.  The  RS232  Interface  is 
also  compatible  with  modems. 

New  products  coming  soon  Memotech  will 
soon  be  introducing  four  new  Sinclair 
compatible  products:  a  high  quality,  direct 
connection  keyboard,  a  digitizing  tablet,  a  16K 
EPROM  and  a  disk  drive.  Watch  for  our  future 
advertisements. 


beginners*  basic 


Exploring  String  Functions 

by  James  A.  Conrad,  Seattle,  WA 


Most  novice  programmers  don’t  understand  much  about 
string  functions.  And  many  not-so-novice  programmers 
don’t  use  them  to  their  full  potential.  Functions  seemed 
relatively  unimportant  when  they  started  learning 
BASIC  — something  to  “get  to  later.”  Well,  “later”  is  now. 
String  functions  are  easy  to  understand. 

String  functions  are  especially  useful  in  writing  input¬ 
checking  and  output-formatting  routines — areas  where 
many  programs  are  weak.  A  few  hours  invested  in  studying 
string  functions  will  pay  dividends  in  user-friendly  programs. 

Many  programmers  tend  to  confuse  functions  and 
statements.  A  statement  is  an  instruction  to  the  com¬ 
puter,  telling  it  to  do  something.  It  contains  (or  is)  a  verb, 
such  as  PRINT  or  GOTO.  Most  functions  calculate  or 
convert.  They’re  like  self-contained  subroutines;  SQR  x, 
for  example,  computes  the  square  root  of  x. 

The  major  BASIC  functions  perform  arithmetic  or  string 
operations.  String  functions  analyze  and  manipulate 
strings.  (For  a  refresher  on  strings,  see  SQ  Winter 
1982.  — Ed.)  They’re  indispensable  in  input-checking  and 
output-formatting  routines. 

A  Few  Words  about  Functions 

Functions  have  two  parts:  a  title  and  an  argument.  The  title 
describes,  in  BASIC,  what  the  function  does,  for  example, 
LENgth,  VALue.  The  argument  follows  the  title  and 
serves  as  the  input  to  the  function.  The  function  uses  this 
input  and  returns  a  result.  A  function’s  argument  is  pro¬ 
nounced  “of”— to  read  the  function  LEN  A$,  for  exam¬ 
ple,  you  say,  “length  of  A  string.” 

You  can  do  almost  anything  with  a  function  that  you 
can  with  a  variable.  You  can  print  it.  If  it’s  numeric,  you 
can  add  or  subtract  it.  You  can  even  put  it  in  the  argu¬ 
ment  of  another  function,  for  example,  LEN  A$(2  TO  5) . 
(This  is  called  nesting.  When  you  nest  functions,  be  sure 
you  put  a  right  parenthesis  for  every  left  one.)  About  the 
only  thing  you  can’t  do  with  most  functions  that  you  can 
do  with  variables  is  assign  values  to  them  with  assignment 
statements  (see  SQ,  Winter  1982). 

The  String  Functions 

First,  a  few  definitions  relating  to  string  functions: 

String:  a  set  of  alphanumeric  and/or  graphic  characters. 
String  variable:  name  given  to  the  memory  cell(s)  to 
which  the  string  is  assigned.  Your  ZX/TS  gives  you  26 
string  variables,  A$  through  Z$. 

Substring:  portion  of  a  string  consisting  of  consecutive 
characters. 

Expression:  a  constant  (such  as  12  or  “BOB”),  a 
variable  (X,  Y$),  or  a  formula  (7*Y,  K$  +  “DAVE”).  If  a 
formula  is  used  in  the  argument  of  a  function,  you  must 
put  it  in  parentheses. 


Here’s  a  summary  of  string  functions,  what  they  do, 
and  a  program  line  that  prints  an  example.  The  symbols  I 
use  in  the  arguments  are: 

$:  string  being  analyzed 

sub$:  substring 

len:  length  of  string  or 

substring 

pos:  position  in  string 

x:  any  numeric  expression 

or  number  the  com¬ 
puter  can  handle 
chr:  character  (in  quotation 

marks)  or  character 
code 

cod:  character  code  (0-255) 

Any  of  these  except  chr  can  be  a  constant,  variable  or 
formula. 

We’ll  set  up  line  10  to  make  a  nine-character  string  A$ 
to  play  with.  Enter  line  10  on  your  computer: 

10  LET 

Slicing 

Slicing  is  a  process  that  gets  substrings  from  strings.  For 
the  academically  inclined,  slicing  is  a  function  without  a 
title— the  entire  slicing  notation  is  the  argument.  The  gen¬ 
eral  form  of  the  slicing  notation  is: 

string  expression  ( slicer ) 

The  slicer  must  be  enclosed  in  parentheses.  Its  general 
form  is: 

( position  1  TO  position  2) 

It  also  has  several  abbreviated  forms,  shown  following: 

Here  is  the  full  form  for  slicing.  It  returns  a  substring  of 
string  $,  beginning  with  character  number  posl  and 
ending  with  the  character  in  pos2: 

$(posl  TO  pos2) 

Enter  line  20  and  RUN  our  two-line  program.  (Note 
that  you  don’t  need  to  type  in  the  spaces  around  TO. 
Your  ZX/TS  does  that  automatically  when  you  use 
SHIFT  4  to  enter  TO). 

20  PRINT  "CHRRRCTER5  2.  3,  RND 

4-  OP  R$  RRE:  ";R$C2  TO  40 

You’ll  see  234  on  your  screen. 

Now  some  shorthand  notations: 

$(  TO  pos2)  posl  omitted  returns  the  left  portion  of 
string  $  through  pos2. 

Add  line  30: 


8 


SYNTAX  QUARTERLY/SPRING  1983 


BEGINNERS1  BASIC 


3®  PRINT  "THE  FIRST  4-  CHHRflCTE 
RS  OF  R$  RRE  :  ";Rt(  TO  4-J 

This  prints  1234. 

$(posl  TO  )  pos2  omitted  returns  the  right  portion  of 
string  $  from  posl  through  the  final  character.  Add  line 
40  to  our  example  program: 

PRINT  -the  right  side  of  r* 

j FROM  LHflRSCTER  5  IS:  ";R$(5  TO* 

Line  40  will  print  56789. 

$(pos  n )  or  $(pos  n  TO  pos  n)  gives  you  the  character  at 
pos  n  in  string  $.  Try  line  50: 

SO  PRTNT  "the  4-TH  CHRRRCTER  OF 
R  *  IP  :  ;  R  $  C  4-  J 

$()  or  ${  TO  )  gives  you  the  entire  string  $  as  a  substring. 
Line  60  demonstrates: 

60  PRINT  "R*  IS:  ";R$f> 

It  prints  123456789. 

LEN  $  returns  the  number  of  characters  in  string  $.  Try 
line  70,  remembering  that  LEN  is  a  function  (press 
SHIFT  ENTER,  then  the  K  key): 

IN®fl*RXsT  ::?hENER*OF  CHflRflCTERS 

You’ll  get  9. 

VAL  $  determines  the  numeric  value  of  string  $.  Line  80 
shows  this  (VAL  is  a  function  on  the  J  key): 

";Ufi(_Pfl*NT  “THE  VRLUE  OF  R*  IS: 

We  get  123456790.  Note  the  computer  rounded  our 
nine-digit  number  to  eight  significant  digits. 

STR$  X  converts  a  numeric  expression  X  into  a  string. 
Try  lines  90  and  100  (STR$  is  a  function  on  the  Y  key): 

30  LET  R=333 

..f?®  PRINT  "THE  STRING  OF  R  IS: 

_«  O  t  n  5  ft 

This  prints  333. 

CODE  $  returns  the  character  code  number  of  the  first 
character  of  string  $.  You’ll  get  zero  if  string  $  is  a  null,  or 
empty,  string  or  if  the  first  character  is  a  blank  space 
(character  code  0).  Line  110  demonstrates  (CODE  is  a 
function  on  the  I  key): 

II®  RRINI  "8$  BEGINS  WITH  CHRRR 
LTER  CODE  NUMBER:  CODE  R$ 

Line  110  prints  29— the  character  code  for  1  (check  your 
manual).  Try  just  entering  PRINT  CODE  “1”.  You’ll  also 
get  29. 


CHR$  cod  gives  you  the  character,  in  a  one-character 
string,  corresponding  to  the  character  code  cod.  Remem¬ 
ber,  cod  can  be  an  expression  (constant,  variable  or  for¬ 
mula)  whose  value  falls  between  0  and  255.  CHR$  is  a 
function  on  the  U  key.  Enter  line  120: 

DE2f9  P?|NT-  "CTER  ™  CO 

This  prints  1. 

Workhorse 

Slicing  is  the  workhorse  of  string  manipulation.  Run  this 
quick  FOR-NEXT  loop  for  a  display  of  its  operation: 

18  LJET  B$='*RBCDE;" 

28  FOR  X-X  TO  4> 

38  PRINT  TO  XI 

4-8  NEXT  X 

We  see  that  as  X  increases,  the  printed  string  changes: 
when  X  is  the  screen  shows 

1  A 

2  AB 

3  ABC 

4  ABCD 
This  is  the  equivalent  of  LEFTS  (B$,X)  in  common 
BASICs.  Sinclair  BASIC  does  not  have  this  function. 

Now  change  line  30  to: 

30  PRINT  B $  (X  TO  ) 

Remember  not  to  type  in  the  spaces  around  TO — use 

SHIFT  4.  RUN  our  program.  Now  we  get: 

when  X  is  the  screen  shows 

1  ABODE 

2  BODE 

3  CDE 

4  DE 

This  is  equivalent  to  the  MID$(B$,X)  function  found  in 
other  BASICs. 

Try  another  change: 

30  PRINT  (X  TO  X+l) 

Now  we  see: 

when  X  is  the  screen  shows 

1  AB 

2  BC 

3  CD 

4  DE 


This  works  like  MID$(B$,X,2)  in  other  BASICs. 
Here’s  a  tricky  one.  Change  line  30  to  read: 

3©  PRINT  B$iLEN  B*-X  TO  } 


This  produces: 
when  X  is 
1 
2 

3 

4 


the  screen  shows 
DE 
CDE 
BCDE 
ABCDE 


This  is  the  equivalent  of  RIGHTS  (B$,X)  in  common 
BASICs. 


SYNTAX  QUARTERLY/SPRING  1983 


<■ 


BEGINNERS’  BASIC 


Here’s  a  quick  program  that  gets  the  same  result  (input 
STEF  using  SHIFT  E): 

10  LET  B$  =  ,*fiBCDE'* 

20  FOR  X=4-  TO  1  STEP  -1 
30  PRINT  CX  TO  ) 

4-3  NEXT  X 

If  you  can  visualize  how  and  why  these  last  two  pro¬ 
grams  produce  the  same  result,  you  have  a  good  under¬ 
standing  of  slicing. 

Concatenation 

Concatenation  (pronounced  kon-kat-e-NAY-shun)  is  a 
fancy  word  that  means  a  combination,  joining,  linking,  or 
chaining.  We  can  concatenate,  or  link,  strings  by  using 
the  concatenation  operator,  the  plus  ( + )  sign.  When  it 
works  on  strings,  it  joins  them.  It  doesn’t  perform 
arithmetic  addition. 

We  can  concatenate  strings  from  string  variables  or 
characters  enclosed  in  quotation  marks.  To  see  how  this 
works,  RUN  this  demo  program: 

13  LET  F$=MDIftNft" 

20  LET  L$=“ JONES" 

30  LET  N$=L$+",  **+F$ 

4-0  PRINT  N  $ 

Line  30  concatenates  “JONES”  in  variable  L$,  a  string  in 
quotation  marks  consisting  of  a  comma  and  a  space,  and 
“DIANA”  in  variable  F$.  It  assigns  the  manufactured 
string  to  variable  N$.  Line  40  prints  it:  JONES,  DIANA 

What’s  in  a  Name? 

Let’s  assume  we  have  a  name  stored  in  variable  N$,  in  a 
mailing  list,  for  example.  (In  an  actual  program,  we 
would  probably  have  a  series  of  names  stored  in  an 
array.)  We  want  to  separate  the  first  and  last  names  into 
the  variables  F$  (first  name)  and  L$  (last  name). 

Here’s  a  routine  to  get  the  first  name  (remember,  the 
computer  ignores  REM  statements  when  executing  a 
program): 

10  LET  N$=“flNN  DOYLE" 

10©  REH  ROUTINE  TO  GET  F$ 

113  FOR  X  =  1  TO  LEN  N$ 

120  IF  N$(X>="  "  THEN  GOTO  14-0 

130  NEXT  X 

14-0  LET  F$=N$C  TO  X-i) 

150  PRINT  F$ 

How  does  it  work?  Lines  110  and  130  set  up  a  FOR- 
NEXT  loop  that  sequentially  examines  each  character  of 
N$.  Line  120  is  the  “do”  portion  of  the  loop.  It  uses  the 
slicing  function  to  test  each  character  one  at  a  time  for  a 
space  (“  ”)  in  N$.  When  the  space  is  found  we  have  the 
first  name. 

Let’s  step  through  the  loop  and  see  what  happens.  On 
the  first  pass  the  index  variable  (counter),  X,  equals  1. 
The  IF  portion  of  line  120  looks  at  the  first  character, 
N$(l),  which  is  “A.”  It’s  not  a  space,  so  X  is  set  to  2  for 
the  second  pass.  The  second  character,  N,  is  tested.  On 
the  fourth  pass  X  =  4  and  the  slicing  function  finds  the 


space  it’s  looking  for.  Because  the  fourth  (Xth)  character 
is  the  space,  we  know  that  the  first  name  is  X-l  characters 
long.  The  THEN  portion  executes  and  jumps  to  line  140. 
Line  140  assigns  the  left  X-l  (three)  characters  of  N$, 
which  are  ANN,  to  variable  F$. 

Now  let’s  find  the  last  name.  We’ll  use  a  different 
technique: 

2@0  REH  ROUTINE  TO  GET  L$ 

210  FOR  X=LEN  N$  TO  1  STEP  -X 
220  IF  N$TX>  ="  “  THEN  GOTO  24-0 
230  NEXT  X 

24-3  LET  L $  =N$  iX  +  X  TO  I« 

250  PRINT  L$ 

Here  we  step  backwards  from  the  right  side  of  N$,  testing 
for  a  space.  When  the  computer  finds  it,  the  THEN  por¬ 
tion  of  line  220  executes  and  transfers  program  control  to 
line  240.  The  slicer  in  line  240,  (X-l- 1  TO  ),  deletes  the 
left  X  characters  from  N$  and  returns  the  right  side  from 
character  X+  1  to  the  end  of  the  string.  The  LET  state¬ 
ment  assigns  the  right  side  of  N$  to  variable  L$. 

Dimensioning  Strings 

Strings  and  string  variables  have  size,  or  length.  Regular 
string  variables  are  the  size  of  the  alphanumeric  informa¬ 
tion  they  contain.  We  can,  however,  set  them  to  a  fixed 
size,  using  a  DIMension  statement. 

DIM  statements  define  the  number  of  characters  in  the 
string  variable  and  initially  fill  it  with  that  number  of 
spaces  (DIM  is  also  used  to  DIMension  arrays— a  subject 
beyond  our  scope  here).  The  statement  DIM  A$(6),  for 
example,  creates  a  string  of  6  spaces  in  variable  A$. 

A$  will  remain  6  characters  long  no  matter  how  many 
or  how  few  characters  we  try  to  assign  it.  You  can 
redimension  a  dimensioned  string  to  a  new  size.  But  if 
you  do,  the  computer  will  reinitialize  it  with  spaces  and 
erase  its  previous  contents.  Once  dimensioned,  a  string 
cannot  be  undimensioned. 

Chopping  and  Padding 

What  earthly  good  is  a  fixed-size  string  variable? 

Suppose  we  have  a  field,  or  space,  16  characters  wide 
for  a  name.  We  want  to  change  our  string  so  it  has  exactly 
16  characters.  How  do  we  do  it?  Let’s  try  it  first  with  a 
long  name,  then  with  a  short  one: 

10  LET  N$="KORZENIOU5KI ,  STRNI 
5LOU" 

1@  LET  N$="DOE,  JfiNE" 

Note  that  Stan’s  name  has  23  characters  and  Jane’s  has  9. 

We’ll  assign  the  result  to  variable  X$.  It’s  easy— we’ll 
just  use  the  DIM  statement  to  create  a  predefined  string 
variable  of  16  characters: 

100  REM  ROUTINE  TO  MRKE  R  16-CH 
RRRCTER  STRING 
110  DIM  X*( 15) 

120  LET  X$5=N$ 


10 


SYNTAX  QUARTERLY/SPRING  1983 


BEGINNERS1  BASIC 


Now  we’ll  print  the  string  from  line  130,  concatenating  a 
period  to  show  where  the  string  ends.  We’ll  print  its 
length  from  line  140: 

13©  PRINT  +  " " 

14-©  PRINT  "LENGTH  OP  >;$  IS  ";LE 
N  X$ 

Line  110  DIMensioned  X$  to  16  characters.  When  line 
120  assigned  N$  into  this  16-character  X$,  Stan  was 
chopped  down  to  size— the  computer  chopped  off  the 
last  seven  characters  of  his  name  (the  fancy  word  is  “trun¬ 
cated  ).  When  we  assigned  Jane’s  9-character  name  to 
the  dimensioned  variable,  the  computer  added  seven 
spaces  to  it  (this  is  called  padding). 

Even  if  the  previous  contents  of  the  dimensioned  string 
were  non-blank  characters,  as  in  Stan’s  case,  assigning  a 
shorter  string,  like  Jane’s  name,  erases  the  previous 
characters  and  pads  the  remainder  of  the  string  with 
spaces. 

Experiment 

Here’s  one  to  try  on  your  own.  Give  Jane  and  Stan  mid¬ 
dle  names.  Put  their  first  names  first  in  N$  (for  example, 
“Jane  Carol  Doe”).  Now  write  a  routine  that  puts  each 
name  in  a  20-character  field  using  this  format:  last  name, 
comma,  first  initial,  period,  space,  middle  initial,  period! 
For  Jane’s  name,  the  result  should  be:  Doe,  J.  C.  fol¬ 
lowed  by  10  spaces. 

Removing  Trailing  Spaces 

When  printing  a  string  from  a  dimensioned  string 
variable,  you  will  often  want  to  remove  trailing  spaces. 
(Have  you  ever  received  a  computer- written  letter  that 
starts,  Dear  Ms.  Doe  ,  You  have  just  won.  .  .”?) 
Here’s  a  routine  to  get  rid  of  those  ugly  spaces  (use 
SHIFT  T  for  the  not-equal  sign  in  iine  120): 

10  DIM  T$(I6) 

11  "!NPUT  «  T«r  string- 
4-0  PRINT  T*  +  "." 

TMn0cS^?OUTINE  TO  REHOUE  TRAIL 
JLNb  OrRCEo 

110  FOR  X=LEN  T$  TO  1  STEP  -1 

111  ■’  THEN  GOTO  *** 

1^©  LET  ft$=T*M  TO  X) 

150  PR INT  ft $  +  " « “ 

160  GOTO  20 

The  routine  loops  backward  through  T$  with  line  120 
testing  each  character  for  a  space.  When  it  finds  a  non¬ 
space  character  (that  is,  the  expression  T$(X)<  >  “  ”  is 
true),  the  program  goes  to  line  140.  Here  the  string  ex¬ 
cluding  the  trailing  spaces  (that  is,  T$(  TO  X))  is  assigned 
to  A$.  Lines  40  and  150  print  the  test  string  before  and 
after  removing  the  trailing  spaces,  concatenating  a  period 
on  the  end  to  show  the  length  of  the  string. 

Programming  Tips 

1 .  Function  titles  appear  under  most  letter  keys.  Pressing 
the  SHIFT  and  FUNCTION/ENTER  keys  will  print  a 


reverse  video  F  (function)  cursor  on  the  message  line. 
This  allows  you  to  type  the  function  title  as  you  would  a 
statement. 

2.  Parentheses  around  a  function’s  argument  are  op¬ 
tional  unless  the  argument  is  a  formula. 

3.  Functions,  including  slicing,  have  the  last  priority  (12) 
in  the  computer’s  order  of  operations.  You’ll  have  to 
define  concatenated  string  expressions  by  putting  paren¬ 
theses  around  them  before  slicing  them.  For  example,  you 
have  to  program  the  expression  A$  +  “,”  +  B$  as 
(A$  4-  “,”  +  B$)  (sheer)  to  avoid  slicing  only  B$. 

4.  Use  the  single  character  slicer  in  input-checking 
routines  to  allow  a  yes/no  input  of  either  the  first  letter  or 
the  entire  word.  In  the  following  example,  YES  goes  back 
to  the  program  start  and  NO  stops.  You  can  change  these 
to  suit  your  needs. 

IS©  PRINT  "ANSWER  YES  OR  NO" 

130  INPUT  R* 

14-0  IF  R$<1)="Y"  THEN  GOTO  1© 

15©  IF  R$C1)="N"  THEN  STOP 

5.  A  string  variable,  once  dimensioned,  can’t  be  un¬ 
dimensioned.  But  it  can  be  redimensioned— and  its  con¬ 
tents  reset  to  spaces.  Previously  dimensioned  string 
variables  are  practically  useless  as  regular  variables.  If  you 
use  dimensioned  string  variables  more  than  once  in  a 
program  (for  chopping  and  padding,  for  example),  see  if 
you  can  redimension  and  recycle  one  you  used  before. 
You  have  a  limited  supply  (26)  of  string  variables,  so 
unless  you  recycle,  it’s  easy  in  a  complex  program  to  run 
out  of  them. 

6.  The  VAL  function  must  be  the  first  item  in  an 
arithmetic  formula.  If  you  can’t  rewrite  the  formula  to  put 
VAL  at  the  beginning,  assign  the  VAL  function  to  an 
arithmetic  variable  first.  Then  use  the  variable  in  the 
formula. 

VAL,  if  used  in  a  PRINT  AT,  PLOT  or  UNPLOT  state¬ 
ment,  must  be  the  first  (row)  coordinate.  To  use  it  as  the 
second  (column)  coordinate,  assign  it  first  to  a  variable. 
For  example,  change  this  line: 

.  t 

14-0  PRINT  ftT  12 ,  UftL  "C" 

to  these  lines: 

135  LET  C=UftL  "C" 

14.0  PRINT  ftT  12..C 

7.  Your  manual’s  appendix  shows  the  complete  Timex 
Sinclair  character  set.  Here’s  a  little  program  that  lists 
them  all: 


10  REH  PRINT  CHARACTER  SET 
20  PRINT  "CODE"  ,  " CHARACTERS 
30  FOR  X=©  TO  255 
4-0  PRINT  X ,  CHR$  X 
50  NEXT  X 


Codes  67-111  and  122-127  will  show  as  a  “?’ 
character.  These  codes  aren’t  used  for  characters. 


SYNTAX  QUARTERLY/SPRING  1983 


iUnfCgl  BEGINNERS*  BASIC 


TRANSLATION  TABLE 
String  Functions 

No  “standard”  BASIC  language  exists  — only  dialects.  This  table  summarizes  the  main  differences  between  most 
common  microcomputer  BASIC  dialects  and  Sinclair  BASIC  (used  in  ZX81s  and  Timex  Sinclair  1000s).  The  table 
refers  only  to  statements  and  operations  used  in  or  related  to  the  accompanying  article.  It  should  help  you  translate 
programs  written  in  common  dialects  into  Sinclair  BASIC.  The  accompanying  article  defines  the  italicized  symbols. 


How  to  Use  It 

What  It  Does 

in  Common 

Sinclair 

Example 

or  Is 

BASIC 

BASIC  Translation 

LEFTS 

Returns  the  left  len 

Most  dialects  use. 

Not  available.  $(  TO  len) 

($,len) 

characters  of  string  $. 

MID$ 

Returns  a  sub¬ 

Most  dialects  use. 

Not  available  $(pos  TO  pos  +  len) 

($,  pos,  len) 

string  of  string  $, 
beginning  with 
character  number  pos 
and  having  length  of 
len  characters. 

M1D$ 

Returns  the  entire  sub¬ 

Most  dialects  use. 

Not  available  $(pos  TO  ) 

($,  pos) 

string  right  of  position 

(len  omitted) 

pos. 

RIGHTS 

Returns  the  right  len 

Most  dialects  use. 

Not  available.  $(LEN  $  -  len  TO  ) 

($,  len) 

character  of 
string  $. 

ASC($) 

Returns  ASCII*  code 

Most  use  common 

Has  own  Use  CODE  $ 

number  of  the  first 

code  for  punctua¬ 

codes,  unre¬ 

character  of  string  $. 

tion,  numbers, 

lated  to  ASCII. 

and  uppercase 

No  cursor 

(*  American  Standard 

letters  but  differ 

control  codes. 

Code  for  Information 

for  graphics 

Interchange) 

characters  and 
cursor  control 
codes. 

DIM  $(x) 

Dimensions  string 

A  few  dialects 

Optional  to  No  changes  needed. 

variable  $  to  x  charac¬ 

require  dimen¬ 

predefine  string  Use  to  simplify  chop- 

ters  and  fills  with 

sioning  of  strings, 

size.  ping  and  padding 

spaces. 

most  don’t  allow. 

routines. 

Redimensioning 

Redimensions  string 

Most  dialects  don’t 

No  restriction.  No  changes  needed. 

variables  (as  above). 

allow. 

See  Tip  5  for  use. 

Parentheses 

Enclose  function’s 

Most  dialects 

Optional  on  Can  usually  be 

argument. 

require. 

most  functions.  omitted.  Best  to  in- 

Slicers  require  elude  (for 

(Tip  2).  portability). 

12 

SYNTAX  QUARTERLY/SPRING  1983 

1 

2 


t 

S 

§ 

a 


! 

2 


I 

8 

* 


8 


II 


s 


2 


8 

II 

Is 


1 

2 
a 


1 

2 


I 

§ 

* 


1 

2 


I 

8 

ft 


Get  serious  about  ZX81 
&  15  WOO  Computing 


Cassette  Software 

IX  FORTH 

A  complete  implementation  of  the  FORTH  language  for 
the  ZX81  and  TS1000  computer. 

FORTH's  most  distinctive  feature  is  its  flexibility.  The 
basic  unit  is  the  word  —  the  programmer  uses  existing 
words  to  define  his  own  which  can  then  be  used  in  fur¬ 
ther  definitions.  FORTH  is  a  compiled  language  so  pro¬ 
grams  run  very  fast  (typically  five  times  faster  than 
BASIC). 

ZX-FORTH  is  supplied  on  cassette  and  is  accompanied 
by  extensive  documentation: 

56-page  Users  Manual 

8'Page  Ed^r  Manual  Z43  $29.95 


ZXBUO 


Machine  Code  Monitor  and  Disassembler 

ZXBUG  is  a  powerful  tool  for  machine  language  pro¬ 
gramming.  It  is  4K  long  and  uses  memory  from  71 EO 
to  the  top  memory.  ZX  BUG  works  in  hexadecimal 
(base  16),  not  decimal,  so  ail  addresses  are  a  max¬ 
imum  of  4  Hex  bits  long.  Provides  a  total  of  28  com¬ 
mands. 

Z41  $14.95 


CA.  Assembler 

This  Machine  Code  program  occupies  7K  of  memory 
and  locates  itself  at  the  top  of  memory.  The  program  is  a 
full  Editor/Assembler  and  Monitor.  Labels  may  be  used 
instead  of  any  string.  The  features  include  Line  Inser¬ 
tion/Delete,  Insert  Characters,  Auto  Repeat  on  all  keys. 
The  monitor  has  facilities  to  inspect  memory,  registers 
and  run  machine  code  programs 

Z40  $14.95 

TOOLKIT  9  Powerful  New  Functions! 

RENUMBER.  This  routine  renumbers  a  program  in  any 
step  and  from  any  line  up  to  9999 
DELETE.  This  command  deletes  a  group  of  lines  in  a  pro¬ 
gram. 

MEMORY.  Prints  how  much  spare  memory  is  available. 
DUMP.  Displays  current  values  of  string  and  numerical 
values,  except  arrays. 

FIND.  Will  find  any  string  of  up  to  255  characters  and  list 
each  line  containing  that  string. 

REPLACE.  Replaces  any  string  of  up  to  255  characters 
by  any  other  string. 

SAVE.  Transfers  program  in  computer  to  below  RAM- 
TOP. 

APPEND.  Allows  two  programs  to  be  joined. 

REMKILL.  Removes  all  REM  statements  from  a  program, 
otherwise  leaving  it  unchanged,  preserving  memory. 

Z42  $14.95 


z-aid  i a 


Includes  the  following  routines: 

VERIFY  confirms  whether  a  program  has  been  recorded 
properly  on  tape.  The  program  in  memory  is  unaffected, 
and  a  further  ‘save’’  can  be  made  if  necessary. 
Mload/Msave  enables  a  specified  block  of  memory  to  be 
saved.  VPTR  can  be  used  within  a  BASIC  program  to 
eliminate  many  tedious  POKES  and  PEEKS  in  finding  the 
addresses  where  variable  values  are  stored. 

CHAIN  allows  the  second  part  of  a  BASIC  program  to  be 
loaded  and  tacked  onto  the  end  of  the  first  part. 

Z  AID  1.0  is  convenient  to  use,  being  loaded  from  tape, 
and  residing  at  the  top  of  16K  memory.  The  user  ac¬ 
cesses  the  various  routines  with  USR  calls  while 
loading,  running,  editing  and  saving  BASIC  programs 

normally  Z98  $14.95 


Msfwy 

( - - -  ~~  Z61  $19.95 

★  Allows  you  to  LOAD  and  SAVE  ZX81 
programs  up  to  6  TIMES  FASTER! 

★  Easy-to-use  in  your  own  programs. 

★  User-transparent  when  incorporated  into 
programs. 

★  Verifies  proper  loading. 

★  Catalogue  feature  lists  program  names  and 
memory  usage. 

★  LOADER  occupies  less  than  500  bytes  (V2  K)  of 
RAM. 

★  Consists  of  2  separate  programs  — 
KEYBOARD  MONITOR  and  FAST  LOADER. 

★  Supplied  on  cassette  with  extensive 
documentation. 

KEYBOARD  MONITOR  is  a  user-friendly 
BASIC  program  which  gives  such  information  as 
the  speed  at  which  the  tape  was  recorded,  file 
name,  file  type,  number  of  bytes  in  file,  and 
whether  a  read  error  occured.  If  desired,  the 
user-friendly  portion  of  the  program  can  be 
removed  for  direct  access  to  Machine  Code 
Monitor.  Both  parts  reside  at  RAMTOP  and  are 
user  transparent.  Full  details  are  given  in  the 
manual  for  fast  saving  of  your  program. 

FAST  LOADER  also  resides  above  RAMTOP 
and  can  be  used  in  front  of  any  fast-saved  pro¬ 
gram  to  enable  it  to  be  fast-loaded.  This  removes 
the  need  to  load  the  monitor  for  each  load. 
Reliability  and  compatability:  Fast-Load  is  an 
exceptionally  reliable  system.  In  one  3  hour  test, 
over  1,300,000  bytes  of  data  were  recorded  and 
then  read  without  error,  using  a  low  cost 
cassette  player.  Compatible  with  all  ZX81 
systems,  at  your  choice  of  two  operating 
speeds:  Medium  Speed  (4  times  faster)  suitable 
for  use  with  any  tape  recorder  that  works  with 
ZX81;  Fast  speed  (6  times  faster)  for  most  higher 
quality  tape  recorders. 

The  Complete  ZX81 
and  TS1000  Library! 

The  Complete  ZX81  Basic  Course .  B70 

Basic  Course  Cassettes  (2) .  $29.95 

Getting  Acquainted  with  your  ZX81 . C70  $8.95 

ZX81  Pocket  Book . P70  $10.95 

Making  the  Most  of  Your  ZX81 . P71  $10.95 

Computer  for  Kids,  ZX81  Edition . C71  $4.95 

Explorers  Guide  to  the  ZX81 . T 70  $12.95 

ZX81  Companion . C72.  $8  % 

49  Exploding  Games  for  the  ZX81  . P72  $10  95 

Not  Only  30  Programs  for  ZX81  :  IK .  B72  $9.95 

Machine  Language  Made  Simple  B73  $14  95 

Mastering  Machine  Code  on  your  ZX81  . .  P73  $12.95 

ZX81  Rom  Disassembly:  Part  A .  Both  for 

ZX81  Rom  Disassembly:  Part  B . $19.95 

Understanding  your  ZX81  ROM  .  B76  $14^5 

CALL  OR  WRITE  FOR  FREE  CATALOG 


with  metal  case 


A  full-sized  professional  keyboard  for  the  ZX81  Features 
47  keys  and  a  full-sized  space  bar.  Connects  to  the  ZX81 
with  no  soldering  required,  via  a  plug-in  flexible  connec¬ 
tor.  You  can  purchase  the  keyboard  only,  or  the  optional 
metal  case  that  holds  both  keyboard  and  ZX81.  Expan¬ 
sion  devices  (i.e.  RAM  packs,  etc)  connect  to  the  ZX81 
edge-connector  which  extends  from  the  rear  of  the 
cabinet. 

A  professional  keyboard  makes  program  entry  easier 
and  less  error-prone. 


$25.00 


Keyboard  K70  $79.95 

Metal  case  for  keyboard 

andZX81  E70  $25.0( 

GL3DSTOPE 

1BKRAM 

Equivalent  in  performance  to  Times  Sinclair  RAM. 

G1 6  $149.95 

B4KRAM 

Expands  the  capacity  of  the  T/S  1000  or  ZX81  to  its 
maximum.  User  transparent.  G64  $149.95 

Coming  soon:  32K  RAM  PIGGY  BACK 
Can  be  used  as  a  stand-along  memory,  or  in  conjunc¬ 
tion  with  16K  (Timex  Sinclair,  Gladstone,  or  any  other) 
to  give  a  total  memory  of  48K.  G32  $99.95 

MEMORIES 

CRAMIC-81  16K  CMOS  RAM 

NEW  RAM  PACK  STORES  16K  EVEN  WITH  POWER 
SWITCHED  OFF 

CRAMIC-81  is  a  16K  RAM  pack  using  CMOS 
technology  for  permanent  data  retention.  Data  can  be 
stored  almost  indefinitely  and  loaded  almost  instantly 
with  virtually  zero  chance  of  erro. 

CRAMIC-81  module  uses  chips  made  in  a  special 
CMOS  technology  which  require  only  a  tiny  amount  of 
power  to  retain  data  when  not  actually  in  operation.  A 
state-of-the-art,  long  life  (10  years)  lithium  battery  sup¬ 
plies  this  power  in  the  standby  mode.  In  the  active 
mode,  power  is  taken  from  the  ZX81.  Used  on  its  own 
it  behaves  like  an  ordinary  Rampack  EXCEPT  that  it 
can  be  powered  down  and  removed.  Program  and  data 
in  it  is  permanently  stored  when  this  is  done. 

An  ordinary  Rampack  can  also  be  connected 
simultaneously.  The  two  RAM  units  then  occupy  the 
same  memory  area  but  either  can  be  selected.  Two 
separate  programs  can  actualy  run  alternately. 

CRAMIC-81  comes  in  an  elegantly  molded  lie-flat 
case  with  a  cabled  connector. 

Cl  2  $179.95 


GLaDSTOnE-kFLECTROmCS 

Mail  order  to  1585  Kenmore  Ave.  Buffalo  N.Y.  14217  Checks  or  money  orders.  No  CODs.  Add  shippinr 


SYNTAX  QUARTERLY/SPRING  1983 


=n  SOFTWARE— GAME 

r==Tl 

^  v  by  Fred  Nachbaur,  Syncware,  El  Monte,  CA 

8K  ROM/1 -16K  RAM 

SYNC  WARS  - 

An  Invasion 


This  game  will  help  you  improve  your  speed  and  accu¬ 
racy  with  the  ZX/TS  keyboard  while  providing 
recreation . 

Computerburg  is  being  invaded  by  a  squad  of  ten 
dread  Synclons,  who  beam  in,  one  at  a  time,  from  the 
hyperspace  deep  within  your  computer.  Your  job  is  to 
zap  them  as  they  appear  on  your  screen.  However,  being 
clever  little  invaders,  they  each  bring  along  a  Syncloid  In¬ 
visibility  Robot  (S.I.R.)  which  emits  a  field  that  hides  the 
Synclon  from  view.  Both  the  Synclon  and  the  S.I.R.  may 
appear  anywhere  on  your  viewscreen,  but  never  in  the 
same  place. 

At  your  disposal  you  have  powerful  lasers  (the  38  keys 
on  your  keyboard,  except  SHIFT  and  SPACE/BREAK). 
By  firing  a  laser  corresponding  to  an  invader’s  position 
you  can  destroy  both  types  of  invaders. 

Press  any  key  to  start  the  invasion.  The  first  Syncloid 
Invisibility  Robot  appears,  surrounded  by  his  field.  You 
must  destroy  the  robot  to  deactivate  the  field,  thus  making 
the  Synclon  invader  visible.  Next,  you  must  zap  the 
Synclon  to  score.  If  you  miss  the  S.I.R.,  the  field  disturb¬ 
ance  is  enough  to  tingle  the  Synclon’s  aerials,  giving 
away  his  position.  If  you’re  fast,  and  push  the  right  laser 
in  time  (V3  second)  you  can  still  hit  the  Synclon  and 
score.  Also,  if  you’ve  destroyed  the  robot  but  miss  the 
Synclon,  you  have  a  brief  amount  of  time  to  correct  your 
error  and  shoot  again.  Your  shot  is  even  valid  if  you  miss 
the  S.I.R.  entirely  but  happen  to  hit  the  Synclon. 

Destroying  the  robot  slows  the  alien’s  transporter 
enough  to  give  you  about  one  and  a  half  seconds  to 
shoot  the  invaders,  but  this  time  decreases  as  subsequent 
Synclons  beam  in.  To  get  the  tenth  team,  you  have  only 
one  second  to  hit  the  S.I.R.  and  then  the  Synclon.  If  you 
miss,  or  exceed  the  time  limit,  the  Synclon  vanishes  again 
into  your  computer,  to  cause  strange  crashes  and  other 
nasty  deeds.  (Not  really,  but  buy  the  premise  and  you’ll 
enjoy  the  game  more.) 

To  enter  the  program  into  a  TS1000  (with  2K  RAM) 
without  RAM  pack,  see  the  instructions.  The  program  will 
not  fit  into  IK  ZX81s,  but  will  run  with  an  external  RAM 
pack.  If  you  are  using  an  external  RAM,  see  the  16K 

14 


modifications.  You  can  simulate  a  2K  machine  with  your 
16K  ZX81  using  POKE  16389,72,  then  NEW.  The  rea¬ 
son  you  should  do  this  is  that  the  screen-fill  routine  in  line 
1  speeds  up  considerably  when  memory  isn’t  tight,  since 
the  display  file  is  already  padded  out  with  spaces.  The 
POKE  followed  by  NEW  resets  your  RAMTOP  address  to 
limit  available  RAM  to  2K. 

SYNC  WARS  With  2K  RAM  Instructions 

1.  Load  Syntactic  Sum  Loader  (SYNTAX  newsletter, 
Aug.  82)  into  your  2K  machine,  and  RUN,  followed  by 
NEW.  (If  you  missed  the  Aug.  SYNTAX,  send  us  a  self- 
addressed  stamped  envelope  for  a  copy  of  Syntactic  Sum 
Loader.—  Ed.) 

2.  Type  in  the  program  as  listed. 

3.  Check  Syntactic  Sum— it  should  equal  51036 
(PRINT  USR  18408).  If  it  does  not,  check  the  program 
for  errors.  Make  sure  you  run  Syntactic  Sum  in  the  FAST 
mode. 

4.  Enter  LET  G$  =  “SYNCWARS  ”  in  immediate 
mode  (note  space  at  end).  Start  recording  and  enter 
GOTO  600.  The  program  will  SAVE  to  tape  and  stop 
with  error  2/610.  Rewind  tape. 

5.  Reset  your  computer  by  pulling  the  plug  or  flipping 
the  reset  switch  if  you  have  one.  This  clears  out  the  Syn¬ 
tactic  Sum  subroutine;  there  isn’t  enough  memory  space 
to  run  the  game  if  any  ML  routines  are  present  beyond 
RAMTOP. 

6.  LOAD  “SYNCWARS  ”  from  tape  (note  the  space 
at  the  end).  When  loaded,  computer  will  stop  with  error 
2/610.  Rewind  the  tape. 

7.  In  the  immediate  mode  (no  line  numbers),  type  in 
the  variables  list.  Do  not  CLEAR  or  RUN  once  you’ve 
started  entering  variables.  Arrays  B$,  C$,  E$,  and  F$ 
store  the  graphic  pictures  of  the  invaders  and  their 
destroyed  counterparts;  you  may  easily  design  your  own 
figures  on  graph  paper  (each  picture  is  five  print  positions 
tall  and  three  positions  wide)  and  then  enter  the  strings 
line  by  line  into  the  appropriate  arrays. 

8.  Again  save  the  program  (this  time  with  variables 
loaded)  to  tape,  overwriting  the  first  version.  Program 
starts  when  saved. 


SYNTAX  QUARTERLY/SPRING  1983 


1  REM  Y.^*:4NOT  $TflB  ,#RND|  TRB 

Vrndtrn 

10  PRINT  RT  R,T;  ; G*,  ,  ,  , "BY 
F.NACHBAUR"  ' 

25  POKE  164-18,0 

RY30  PRINT  OT  M,0;  "PRESS  P  TO  PL. 

4-0  PAUSE  U 
50  RAND 
100  LET  5=0 
110  FOR  C=P  TO  T 
120  CLS 

130  LET  D  =  I NT  (RNDiU) 

14-0  LET  E  =  INT  (D-'T) 

150  LET  G=  (D-T*E)  *©+E 
160  LET  E=E*N-P 
180  LET  H=INT  (RNDiU) 

185  IF  H=D  THEN  GOTO  U+U 
190  LET  I = I NT  (H/T) 

210  LET  K=  (H-T*I)  *©  +  I 
215  LET  I=I*N— P 

220  PRINT  USR  16514- ;  RT  H.O;H* 
260  FOR  R=P  TO  R 
264  PRINT  RT  E+fi,G;C*(A) 

268  NEXT  R 
270  PAUSE  U-©*C 

290  IF  INKEY *=""  THEN  GOTO  U*R 
g00  IF  INKEY*=R*  IH+P)  THEN  GOTO 

n3I®TIF  INKEY* < >A* CD+P)  THEN  GOT 

320  CLS 

330  FOR  R=P  TO  R 
335  PRINT  RT  E+A  ,  G;  E*  (R)  ;  RT  I+R 
D$  l  R} 

340  NEXT  R 
350  PRUSE  U-©*C 

IP  INKEY*=""  THEN  GOTO  U*R 
Q3jPS^IF  INKEY* < >R* (H+P)  THEN  GOT 

40©  FOR  A=P  TO  R 

404  PRxNT  RT  I+R,K:F*(R) 

408  NEXT  R 

410  LET  S=S+P 

42©  PRINT  RT  M,0;D*;S 

430  PRUSE  U 

440  GOTO  L 

45©  CLS 

460  PRINT  RT  T,T;"TOO  SLOW  " 

465  PRUSE  U 
47©  GOTO  L 

490  PRINT  RT  I+P.K;"*B*“ 

494  PRUSE  U 

^36  IF  INKEY *=A*  (H+P)  THEN  GOTO 
50©  NEXT  C 

D|S|  PRINT  RT  T  ,  T  ;  “GAME  OVER",,, 
56©  IF"  S=T  THEN  PRINT 


51836,  SK  ROM 


~L 


570  GOTO  M 
6©0  SRUE  G* 

6 I©  GOTO  T 
SYNTACTIC  SUM: 


Notes  for  2K  Listing 

1  Graphics  on  T,H,5,Y 
10  Inverse  space 

30  “P, R,E,S,S, spc, P, token  TO  ,P,L,A,Y” 
220  Screen  fill 
460  Token  “SLOW” 

490  Second  character  is  inverse 
560  Inverse  video 

Variables 

(Enter  in  immediate  mode) 

LET  L  =  500 
LET  M=23 
LET  N  =  6 


LET  0  =  0 
LET  P  =  1 
LET  Q  =  3 
LET  R  =  5 
LETT  =  10 
LET  U  =  38 
LET  V  =  90 
LET  W  =  40000 

LET  A$  =  “1234567890QWERTYUIOPASDF 
GHJKL  ZXCVBNM.”  Note  space  between  L 

and  Z. 

LET  D$  =  “SCORE  =  ” 


LET  G$  =  “SYNCWARS 
LET  H$  =  “  ” 

LET  A$(30)  =CHR$  118 

DIM  B$(5,3) 

DIM  C$(5,3) 

DIM  E$(5,3) 

DIM  F${5,3) 

LET  B$(l)  =“>  <” 

LET  B$(2)  =“E _ R” 

LET  B$(3)=“_F_” 

LET  B$(4)  =  “W6Q” 

LET  B$(5)  =“Q7W” 

LET  C$(1)=B$(1) 

LET  C$(2)  =B$(2) 

LET  C$(3)  =  _ 7 _ ” 

LET  C$(4)  =  “Q _ W” 

LET  C$(5)  =“E  R” 

LET  E$(l)  =  “  /  ” 

LET  E$(2)  =“<  <” 

LET  E$(3)  =  “TE*” 

LET  E$(4)  =C$(4) 

LET  E$(5)  =C$(5) 

LET  F$(l)  =“GOT” 

LET  F$(2)  =“  *  ” 

LET  F$(3)  =“*_!_*” 

LET  F$(4)=F$(2) 

LET  F$(5)  =“M*E” 


Note  space  at  end. 

Space. 

“Enter”  character  (replaces 
space  in  A$). 

Synclon  array. 

Syncloid  array. 

Broken  Syncloid. 
Destroyed  Synclon. 
Greater  than  spc  less  than. 
Graphic  E,  inverse  spc, 
graphic  R. 

Inverse  spc,  graphic  F, 
inverse  spc. 

Graphic  W,  graphic  6, 
graphic  Q. 

Graphic  Q,  graphic  7, 
graphic  W. 


Inverse  spc,  graphic  7, 
inverse  spc. 

Graphic  Q,  inverse  spc, 
graphic  W. 

Graphic  E,  normal  spc, 
graphic  R. 

Spc/spc 

Less  than  spc  less  than . 
Graphic  T,  graphic  E, 
normal  *. 


Second  *  is  inverse. 


SYNCWARS  For  16K  Machines 

With  a  16K  RAM  pack,  you  may  POKE  16389,72  and 
POKE  16388,24  then  NEW  to  give  you  enough  room  for 
Syntactic  Sum  plus  the  program  and  variables.  The 
PRINT  USR  address  in  this  case  is  18432,  and  you 
don’t  have  to  dump  the  ML  routine  before  loading  the 
variables  and  starting  the  program  going. 

If  you’d  prefer  not  to  POKE  RAMTOP,  but  wish  to  use 
your  16K  machine,  enter  the  program  as  written  and  add 
the  following  lines: 


SYNTAX  QUARTERLY/SPRING  1983 


15 


1  REM  SYNCWARS 


Replaces  old  line 
1  ML  screen  fill 

220  FOR  A  =  OTO  M-P 

230  PRINT  “ . ’ 

240  NEXT  A 

500  FOR  A  =  P  TO  RND* SQR  W  Replaces  old  line 

500 

510  NEXT  A 
520  NEXT  C 

NEW  SYNTACTIC  SUM  =  53311 


1 

REM  5YNCURR5 

1© 

PRINT  RT  R  ,  T  ;  ;G$,  ,  ,  . 

‘BY 

F.NRCHBRUR'1 

25 

POKE  164 18 . O 

30 

PRINT  RT  MiO; “PRESS  P  TO  PL 

RY" 

4-0 

PRU5E  U 

50 

RRND 

10© 

LET  5=0 

110 

FOR  C=P  TO  T 

120 

CLS 

13© 

LET  D=INT  (RNDfU) 

14-0 

LET  E=INT  CD/T) 

150 

LET  G=  <D-T*E)  *©+E 

16© 

LET  E=E*N-P 

180 

LET  H  =  INT  (RND*U) 

185 

IF  H=D  THEN  GOTO  U+U 

12© 

LET  I = INT  CH/T) 

210 

LET  K=  CH-T*I)  *0  +  1 

215 

LET  I=I*N-P 

22© 

FOR  R=0  TO  M-P 

23© 

PRINT  ’*  ...............  - 

•  .  -  - 

24-0 

NEXT  R 

26© 

FOR  R=P  TO  R 

264- 

PRINT  RT  E+R..  G;  C$  (R> 

268 

NEXT  R 

27© 

PRUSE  U-G*C 

298 

IF  INKEY  $  =  **  "  THEN  GOTO 

U*R 

300 

IF  INKEY $  =R $  C  H  +P  >  THEN 

GOTO 

U*T 

310 

IF  INKEY$<>R$(D+P)  THEN 

GOT 

O  L-I 

- 

320 

CLS 

338 

FOR  R=P  TO  R 

335 

PRINT  RT  E+R,G;Ei(fl) ; RT 

I+R 

,K; C R> 

34-© 

NEXT  R 

35© 

PRUSE  U-Q*C 

37© 

IF  INKEY  $  =  ** ""  THEN  GOTO 

UiR 

375 

IF  INKEY$Ofl$CH+P)  THEN 

GOT 

O  L-T 

4-00 

FOR  R=P  TO  R 

4©4 

PRINT  RT  I +R ,K;F$ iH) 

4-©S 

NEXT  R 

41© 

LET  S=S+P 

420 

PRINT  RT  MjO;D$;S 

43© 

PRUSE  U 

44© 

GOTO  L 

45© 

CLS 

460 

PRINT  RT  T.T; "TOO  SLOW 

•* 

465 

PRUSE  U 

47© 

GOTO  L 

42© 

PRINT  RT  I+P , K;  “  *fi*" 

424 

PRUSE  U 

426 

IF  INKEY $=R$ (H+Pi  THEN 

GOTO 

U*T 

5©0 

FOR  R=P  TO  RND*SQR  U 

510 

NEXT  R 

53© 

NEXT  C 

55© 

PRINT  RT  T  « T ;  **  GRME  OUER"  ,  ,, 

d$;  Si 

H$: 

56© 

IF  S=T  THEN  PRINT 

570 

GOTO  M 

60© 

5 RUE  G$ 

61© 

GOTO  T 

SYNTRCTIC  SUM:  53311.,  SK  ROM 

This  modification  randomizes  the  length  of  time  be¬ 
tween  successive  invader  pairs,  making  the  game  a  little 
less  predictable.  The  routine  in  lines  220-240,  while  tak¬ 
ing  more  memory  than  the  MC  screen  fill  (and  therefore 
unusable  in  the  2K  version),  is  faster  and  allows  the  next 
Syncloid  to  appear  almost  immediately,  or  delay  for  a 
while,  as  determined  by  the  dummy  loop  in  lines 
500-510. 

Running  the  Program 

The  program  starts  automatically  when  loading  from 
tape.  When  playing  the  game  be  careful  not  to  press  the 
SPACE/BREAK  key;  to  do  so  will  break  operation. 
CONTinue  will  not  work  to  restart  the  program,  making  it 
cheat-proof.  If  you  hit  BREAK  by  mistake,  you  can  start 
the  program  again  by  entering  GOTO  0  (or  GOTO  O  or 
GOTO  P). 

ZX80s 

Since  the  program  runs  in  the  FAST  mode,  it  will  run  in 
ZX80s  with  8K  ROM,  even  without  video  upgrade  mods. 
Minimum  RAM  requirement  is  2K. 

IK  Machines 

Finally,  here’s  a  listing  of  the  game  which  will  run  in  IK 
ZX81s  and  ZX80s  with  8K  ROM  update.  As  with  the  2K 
version,  you  must  load  Syntactic  Sum  (if  used)  and  then 
type  in  the  program;  check  Syntactic  Sum,  and  when 


Available  from  SYNTAX. . . 


For  computing  beginners  — 

Crash  Course  in  Microcomputers  . $19.95 

Covers  hardware,  machine  language  and 
applications.  Reviewed  in  SYNTAX,  Oct.  1981. 
Add  $1.50  shipping. 

ZX80  Pocket  Book . $10.95 


Includes  ZX81  supplement.  Covers  Sinclair 
BASIC,  data  and  program  listings. 

Add  $1.50  postage. 

For  advanced  hardware/ software  users  — 


Zilog’s  Z80-Z80A  CPU 

Technical  Manual . $7.88 

Zilog’s  Assembly  Language 

Programming . $15.75 

Experiments  in  Artificial 

Intelligence . $8.95 

Add  $1.50  postage. 


SYNTAX  back  issues  available,  $4  each. 

Call  or  write  for  our  group  subscription  discounts. 

SYNTAX  •  RD  2  Box  457  •  Harvard,  MA  01451 
617  /  456-3661 


16 


SYNTAX  QUARTERLY/SPRING  1983 


correct  save  the  program  to  tape.  Then  reset  the  machine, 
load  from  tape,  and  enter  the  variables.  Type  GOTO  0  to 
start  the  game.  Don’t  forget  to  save  the  program  with  var¬ 
iables,  overwriting  the  first  SAVE. 

This  version  is  more  difficult,  since  you  don’t  have  a 
second  chance  to  get  the  invaders.  Also,  the  display  is 
considerably  smaller  and  the  invaders’  positions  are  not 
staggered  to  match  the  layout  of  the  keyboard.  Note  that 
if  the  invaders  appear  at  any  of  the  last  three  positions  in 
the  bottom  row,  you  must  hit  to  score. 

Notes  for  IK  Version 

124  20  periods. 

250  Graphics  on  R,E;  E,R. 

320  Graphics  on  5,Y;  2  inverse  Graphics  on  T,Y. 

Variables 

LET  L  =  500 
LET  P  =  1 
LET  Q=2 
LET  R=4 
LET  T  =  10 
LET  V  =  90 

LET  A$  =  “1234567890QWERTYUIOPASDF 
GHJKL  ZXCVBNM .  .  (LEN  A$  should  be  40) 

LET  A$(30)  =CHR$  118 

To  start,  enter  GOTO  0  or  GOTO  P.  In  this  version,  if 
you  hit  the  SPACE/BREAK  key  by  mistake,  it’s  ok  to 
type  CONTinue  and  keep  going.  If  you  type  RUN  by  mis¬ 
take,  reload  the  variables  list  and  start  with  GOTO.  You 
may  prefer  to  run  this  version  in  SLOW  mode.  SQ 


li  pIuse  ST  r'r;"syncuprS- 

100  LET  S=P -P 
110  FOR  C=P  TO  T 
115  CLS 

122  FOR  E=Q  TO  T-P 
124-  PRINT  " . . 


126  NEXT  E 

130  LET  E=INT  (RND*R) 

14-0  LET  G  =  INT  (RND  *T> 

150  LET  D=T*E+G+P 

160  LET  E=E*Q 

170  LET  I =INT  (RNDiR) 

19©  LET  K=INT  (RNDjT) 

200  LET  H=T*I+K+P 

205  IF  H=D  THEN  GOTO  U+U 

21©  LET  1=1*0 

250  PRINT  AT  E  .GiQ;  "T"  ;TAB  G*Q 
' 270  PRUSE  U 

280  IF  INKEY$=R$(H)  THEN  GOTO  L. 
-U 

200  XF  INKEY$< >R$  CD)  THEN  GOTO 

L 

300  CL-3 

320  PRINT  RT  E ,GfO; " </u;TftB  G*G 

;  "i  V' ;  RT  i ..  K  *Q ;  "HI" ;  tab  k 
325  PAUSE  U 

33©  XF  INKEY$Ofi$(H)  THEN  GOTO 

L_ 

4-1©  LET  S=5+P 

4-20  PRINT  RT  I,K^O;  'T/’UTAB 

;  V'j  5 

4-05  PRUSE  V/S 
5©0  NEXT  C 

510  PRINT  RT  T ,P; "YOU  GOT  ";S;" 
SYNCLONS” 

SYNTACTIC  SUM:  29905..  3K  ROM 


IIS  INTERCOM PUTCR  INC 

T  M 

presents 

A  Full  Line  Of  Quality 

SOFTWARE 
For  Your  TIMEX  1000 
Or  SINCLAIR  ZX81 

IC's  new  line  of  software  includes  action-packed, 
challenging  programs  which  put  the  user  in  the 
pilot's  seat  of  an  air  force  bomber;  into  the 
casinos  of  Las  Vegas;  behind  the  controls  of  a 
nuclear  missile  launcher;  alongside  the  President 
as  his  bodyguard;  in  a  lost  spaceship,  far  from 
earth;  in  command  of  a  submarine  destroyer, 
and  challenge  him  or  her  to  other  mind  and 
strategy  games. 

DEALERS  AND  DISTRIBUTORS 
WELCOME 

WE  ACCEPT  CALL  ORDERS 

....  ..  WITH  VISA  OR  MASTERCARD 

Write  or  Mail  to: 

INTERCOMPUTER,  INC. 

P.  O.  Box  90,  Prudential  Center 

Boston,  Mass.  021 99  (61 7)  437-1 1 90 

»— v— —  —  —order  form—— — .  —  —  ... 


U.  S.  $~ T TOTAL- 


10195 


10195 


1 0|  95 


1 0|  95 


10195 


10|95 


10l95 


14l50 


14|50 


1 4|  50 


10|95 


14|50 


59.95 


109.95 


179.95 

All  Programs  require  16K  RAM  Sub  Total  1 - 1 — 

•Defective  tapes  will  be  replaced,  # - 

if  returned  within  3  days.  *5%  Mass.  Tax 

•Please  allow  2  weeks  for  delivery.  TOTAL 

•Your  order  may  be  sent  in  more  *Mass.  Residents  Only 

than  one  shipment. 

□  Check  enclosed  D  Charge  my  credit  card  below 

Name  ' 


1002 

Missile  Launcher 

1003  | 

Jeopardy 

1004  j 

Vegas 

1005 

Demolisher 

1006  i 

Air  Attack 

Guard  the  President 


1008  Combo  PAK  I _ 

1009  Combo  PAK  II 


I -  Combo  PAK  III _ 

1 1 01 1  Submarine 

11012  "Combo  PAK  IV 

!  pQ01  Memopak  16  K  RAM 


P002  I  Memopak  32  K  RAM 


Memopak  64  K  RAM 


I  Company 


City 

Signature 
Card  Number 


□  visa  □  Maste 


Expiration  Date 


SYNTAX  QUARTERLY/SPRING  1983 


17 


SOFTSYIMC,  #/VC. 

THE  WORLDS  BEST  PROGRAMS 
THE  WORLDS  BEST  PROGRAMMERS 


JOIN  THE  FAMILY.  CALL  OR  WRITE  FOR  A  FREE  TS1000/ZX81  CATALOG 
AND  PROGRAM  LISTING  AND  OR  DETAILS  ON  PROGRAM  DISTRIBUTION 


14  E.  34th  St.  NEW  YORK,  NEW  YORK,  10016  212-685-2080 


ffpl  SOFTWARE— EDUCATION 

v  by  Steven  Walley,  Sunnymead,  CA 


8K  ROM/1 6K  RAM 


Geography 
Review— U.S.  States 
Quiz  Program 


I  recently  adapted  an  idea  for  a  program  from  Tab’s 
The  A  to  Z  Book  of  Computer  Games.  The  result  is  a 
states  quiz  that  reviews  the  geography  of  the  U.S.  It  is  a 
good  teaching  tool  for  children  and  a  good  review  for 
adults. 

The  program  requires  the  8K  ROM  with  16K  RAM  and 
works  best  in  the  FAST  mode. 

Your  objective  is  to  match  a  state  (the  program  picks 
one  at  random)  to  a  list  of  9  regions  and  1  state  capitol  in 
the  United  States.  If  you  fail  on  your  first  try,  the  program 
gives  you  a  second  chance.  If  you  fail  again,  you  get 
another  try  later  on  in  the  quiz. 

The  program  keeps  giving  you  states  to  match  until 
you  get  all  50  right.  When  you  answer  all  50  states  cor¬ 
rectly  the  program  tells  you  how  many  guesses  you  took. 
The  first  guess  is  free:  the  computer  only  counts  a  wrong 
answer  if  you  miss  it  twice.  This  helps  not  to  discourage 
children  from  completing  the  quiz.  If  you  want  to  refer  to 
the  quiz  instructions  at  anytime,  just  push  key  I  (for  in¬ 
structions)  and  they  will  appear  on  the  screen.  To  see 
your  score  at  anytime,  push  key  S.  To  quit,  push  Q. 

After  ENTERing  the  program,  hit  RUN  and  ENTER. 
The  program  is  SAVEd  under  the  title  “USA”. 

U.S.  States  Quiz  uses  the  string  slicing  capabilities  of 
the  Sinclair  8K  ROM  as  the  method  of  getting  information 
out  about  the  50  states.  To  speed  up  the  program,  the 
most  frequently  used  routines  are  at  the  beginning.  The 
program  also  makes  use  of  the  INKEY$  function  instead 
of  INPUT  followed  by  ENTER.  This  reduces  the  number 
of  keys  you  must  press. 

Listing  1  describes  the  variables  used  and  their  func¬ 
tions.  Instructions  for  U.S.  States  Quiz  are  contained  in 
lines  8010-8090.  To  exit  from  the  program,  just  push 
BREAK. 

Listing  1 

A  How  many  times  (0  or  1)  you  missed  the  question. 
B  —  How  many  questions  you  answered  correctly. 

C  —  How  many  questions  you  answered  incorrectly. 

D  —  The  number  of  states  you  have  been  asked  to 
match. 


E  —  Does  the  player  have  a  name?  (0  if  no) 

F  —  Random  number  (1  to  50)  picks  which  state  the 
question  is  about. 

G  Counts  the  states  to  see  if  all  have  been  answered 
correctly. 

A$(F,  1  to  16)— State  data.  The  first  element  of  the  string 
is  the  location  (0  to  9) ,  the  second  is  if  it  has  been  guessed 
(1)  or  not  (0) ,  the  remainder  of  the  string  names  the  state. 
B$  —  Player’s  name. 

C$  —  Key  on  the  keyboard  that  has  been  pushed. 

D$  —  Name  of  the  location  picked. 

E$  —  Name  of  the  correct  location. 


SQ 


ig  usr 

20  C!_:5 

30  GO SUB  9000 

4-0  PRINT  "URNT  INSTRUCT  JONS  (V 
OR  N) 

5©  PRUSE  4-©0©0 

GOT5N§l^f  =  ,'N"  ™EN  GOTO  S0 

§0  CL.  3 

3©  PRINT  "UHRT  IS  YOUR  NRHE7" 
10Q  INPUT  B$ 

110  LET  E  =  1 

la©  LET  F  =  INT  (RNDiSB)  +1 
130  IF  R$fF,2) <>"8"  THEN  SOTO  1 

14-0  GOTO  1000 
150  PRUSE  4-0000 
160  LET  C  $  =  INKEY  $ 

IT©  CLS 

IF  C$  =  THEN  GOTO  S00© 

130  IF  C$="s"  THEN  GOTO  7000 
=i00  IF  C$  =  "Q"  THEN  GOTO  6000 
210  REM  ERROR  TRRP 

220  IF  C$  =  "©*‘  OR  C$  =  "  1 "  OR  C$  = ' 
OR  C$="3"  OR  C$  =  "4-''  OR  C$=''5' 
005*C*  =  :,6‘'  9R  CS  =  "7"  OR  Cl  =  "8"  O 
R  C  t =  3  THEN  GOTO  25© 

230  GOTO  100@ 

24-3  REM  LOCRTION  GUESSED 
|Tp0  IF  C*  =  "0”  THEN  LET  D*  =  "REMO 

F?S®  IF  C*="I"  THEN  LET  D$-"PflCI 

n|Z0  IF  THEN  LET  D$=" HEXI 

28©  IF  C$  =  "3’'  THEN  LET  D*  =  "GULF 

_  Continued  Next  Page 


SYNTAX  QUARTERLY/SPRING  1983 


19 


290  IF  C*  =  "4-"  THEN  LET  D*="fiLRN 

124©  IF  R$(F,1)="6"  THEN  LET  E$= 

TIC" 

"CRNRDR" 

30©  IF  C$="5"  THEN  LET  D$="GRER 

1250  IF  fl$  CF. 1)  ="7"  THEN  LET  E$  = 

T  LRKES  ** 

" CHRRLEST ON " 

31©  IF  C$  =  **  6  "  THEN  LET  D$  =  "CflNR 

1268  IF  R$CF..  1)  ="3"  THEN  LET  E$- 

Dh" 

"HISS .  RIUER" 

320  IF  C  $  =  "  7  **  THEN  LET  D$  =  ,,CHRR 

127©  IF  R$  (F .«  1)  =  "9"  THEN  LET  E$  = 

LE5TON" 

"WESTERN" 

330  IF  C$="S"  THEN  LET  D$="MIS5 

1280  GOTO  158 

.  RIUER" 

199©  REM  RIGHT  RNSUER  ROUTINE 

34-6  IF  C|  =  ''9"  THEN  LET  D*  =  "UE5T 

2©0©  PRINT  "UQU,  ";Bt 

ERN" 

2010  PRINT  ,  ,D*;  "  MRTCHES 

35©  IF  R$(F,  1)  =C$  THEN  GOTO  20© 

,3  TO  16) 

© 

2020  PRINT  "YOU  PICKED  THE  RIGHT 

36©  IF  R<>©  THEN  GOTO  478 

RNSUER. " 

3*70  PRINT  "SORRY  «  ";B$ 

2©3©  PRINT  . , s , "PUSH  RNY  KEY  (EX 

36©  PRINT  E>$;  "  IS  NOT  THE  MRT CM 

CEPT  SPACE)  FOR  THE  NEXT  STRTE." 

TO" 

2©4-©  PAUSE  4.©0©0 

39©  PRINT  R$CF.3  TO  16) 

205©  LET  ft$(F.2)="l" 

4-88  PRINT  ,  ,  "YOU  GET  ONE  MORE  C 

206©  LET  R=© 

HRNCE  TO  MRTCH" 

2078  LET  B=B+1 

4-1©  PRINT  fl$(F,3  TO  16) 

2080  LET  D=D+1 

4-2©  PRINT  "TO  THE  RIGHT  LOCRTIO 

209©  FOR  G=1  TO  50 

N  —  " 

2100  IF  fl$(G,2) ="0“  THEN  GOTO  12 

43©  PRINT  ./‘PUSH  RNY  KEY  CEXCE 

0 

FT  5PRCE)  TO  TRY  RGRIN." 

2110  NEXT  G 

448  LET  H= 1 

2120  REM  RLL  58  STRTES  MRTCHED  C 

45©  PROSE  40©00 

ORRECTLY 

46©  GOTO  I©©© 

2138  CLS 

4-7©  PRINT  "SORRY  ";B$ 

214-0  PRINT  "UERY  GOOD  ";B* 

48©  PRINT  "YOU  MISSED  TWICE" 

215©  PRINT  "YOU  HRUE  MRTCHED  RLL 

400  PRINT  ,  E$ 

5©  STRTES" 

500  PRINT  “UPS  THE  RIGHT  RNSUER 

2160  PRINT  "CORECTLY." 

FOR" 

2170  PRINT  ,  ,  **  ******THESE  RRE  YO 

510  PRINT  R$(F,3  TO  16) 

UR  SCORES*****" 

52©  PRINT  *  j  ,  ,  "PUSH  RNY  KEY  (EX 

2180  PRINT  , , , j "STRTES  RTEHPTED 

CEPT  5PRCE)  FOR  THE  NEXT  STRTE" 

TO  MRTCH  D  —  I 

53©  LET  C=C  +  1 

2190  PRINT  ,  ,  " ST RTES  MRTCHED  COR 

540  LET  D=D+1 

RECTLY  " ; B 

55©  LET  R=8 

2200  PRINT  ./'STATES  MRTCHED  INC 

56©  PRU5E  40080 

ORRECTLY  " ; C 

578  GOTO  128 

2210  PRINT  ,,"****************** 

GO©  REM  INSTRUCTIONS 

**************** 

100©  CLS 

2220  PRINT  , , , , "TO  PLRY  RGRIN  PU 

1018  PRINT  "HELLO  ";B$ 

SH  *’**." 

102©  PRINT  RT  0.30ID 

2230  PRINT  ./‘TO  END  THE  QUIZ  PU 

103©  PRINT  j , "WHICH  LOCRTION  WIL 

SH  "  "Z"  "  .  " 

L  MRTCH" 

224©  PRUSE  40088 

1840  PRINT  R$(F,3  TO  16) 

225©  CLS 

1050  PRINT  " ** *** ********** ** *** 

2260  IF  INKEY$="Y"  THEN  RUN 

************** 

2270  IF  INKEY$="Z"  THEN  GOTO  229 

1068  PRINT  RT  6 ,  11;  "LOCRT IONS" 

0 

107©  PRINT  ,  ,"0)  REMOTE  (2 

228©  GOTO  2148 

STRTES  MRTCH" 

229©  PRINT  RT  I0..5;  "GOODBYE  **;B* 

1080  PRINT  "1>  PRCIFIC  C3  ST 

230©  STOP 

RTES  MRTCH) " 

5990  REM  STOPPING  THE  QUIZ 

109©  PRINT  "2)  MEXICO  C3  ST 

500©  CLS 

RTES  MRTCH) " 

6810  PRINT  B$ 

1188  PRINT  "3)  GULF  (4  ST 

6020  PRINT  ./’TO  STRRT  RGRIN  FRO 

RTES  MRTCH) " 

H  THE  BEGINNING  PUSH  ""X 

111©  PRINT  “4)  RLRNTIC  (13  S 

*5  m  6  ^  it 

TRTES  MRTCH) " 

6830  PRINT  j  j.  "TO  CONTINUE  THE  OU 

1128  PRINT  " 5)  GRERT  LRKES  C7  ST 

IZ  PUSH  ""Y""." 

RTES  MRTCH) " 

6040  PRINT  ./‘TO  END  THE  QUIZ  PU 

1138  PRINT  "6)  CRNRDR  (4  ST 

SH  ""Z""." 

RTES  MRTCH) " 

685©  PRUSE  40000 

1140  PRINT  "7)  CHRRLEST  ON  Cl  ST 

606©  IF  INKEY$=“X"  THEN  RUN 

RTE  MRTCHES) " 

6878  IF  INKEY  $  =  "Y  **  THEN  GOTO  108 

1150  PRINT  "8)  MISS.  RIUER  (5  ST 

© 

RTES  MRTCH) " 

6880  IF  INKEY  $  =  "Z"  THEN  GOTO  610 

1168  PRINT  "9)  WESTERN  C8  ST 

8 

RTES  MRTCH) " 

6098  GOTO  600© 

1178  PRINT  , , . . "PUSH  FOR  T 

61©8  CLS 

HE  INSTRUCTIONS" 

oil©  PRINT  RT  10.5; "GOODBYE  " ; B $ 

1188  IF  R$(F,1)="0"  THEN  LET  E$= 

612©  PRUSE  52© 

"REMOTE" 

6138  STOP 

119©  IF  R$(F,1)="1"  THEN  LET  E$= 

699©  REM  SCORE 

"PRCIFIC" 

7©0©  CLS 

120©  IF  R$  ( F .«  1 )  =  "2"  THEN  LET  E$  = 

7810  PRINT  6$;",  THESE  RRE  YOUR 

"MEXICO" 

SCORES-" 

121©  IF  R|(F. 1) ="3"  THEN  LET  E$= 

782©  PRINT  ..  ,  .  ."STRTES  RTTEHPTED 

"GULF" 

TO  MRTCH  **  ;  D-l 

1228  IF  R$(F,1)="4"  THEN  LET  E$= 

7030  PRINT  . . "STRTES  MRTCHED  COR 

"RLRNTIC" 

RECTLY  " ; B 

1238  IF  R$ (F  *1)  ="5"  THEN  LET  E«f*  = 
"GRERT  LRKES" 

Continued  Next  Page 

20 


SYNTAX  QUARTERLY/SPRING  1983 


orrIctlyNT-:c"STOTES  mrtched  inc 
X®E®  “PUSH  ONY  KEY  (EX 

LEPT  SPfiCE)  TO  CONTINUE.” 

70t>0  PAUSE  4-0000 
7070  GOTO  1000 
7990  REM  INSTRUCTIONS 
8000  CLS 

5S1£=ERINT  "THIS  QUIZ  WILL  TEST 
1°,  IFc  YOU  CRN  MRTCH  R  STRT 

f  UITH  ITS  LOCATION  {REGION  OR 
gTOIE  CAPITOL)  IN  THE  U.S. 

3020  PRINT  "AFTER  YOU  SEE  THE  FI 
RST  STRTE  QNTHE  SCREEN*j*ittftjtt 
************" 

®®3©  PRINT  "PUSH  0-9  TO  MRTCH  TH 
E  STRTE  SHOWN  TO  ONE  OF  THE 

LOCATIONS  SHOWN." 

8040  PRINT  "PUSH  ""I""  TO  SEE  TH 
E  INSTRUCT IONSRGR IN . " 

URSSCORE^  "PUSH  *"S""  TO  SEE  YO 
SeSglPRINT  “PUSH  ""Q""  TO  END  TH 

?®X®  PRINT  "THE  LOCATIONS  RRE  LI 
5XED  IN  THE  priority  TO  BE  RNSWE 
RED  (EXAMPLE -IF  fl  STRTE  BORDERS 
BOTH  CRNRDR  RND  THE  GREAT  LAKES , 
GREgT  LAKESWILL  BE  THE  CORRECT 
fif1SWER  BECAUSE  XT  IS  HIGHER 

UP  ON  THE  LIST  OF  LOCATIONS.  *' 
3080  PRINT  "**************»***.*«. 
************" 

§S2®..PRINT  "NOU  PUSH  ENTER  TO  BE 
is  XN  > 

8100  PAUSE  4-0000 
8110  IF  E=0  THEN  GOTO  S0 
8120  IF  E  <  >0  THEN  GOTO  1008 
8990REMLOAD  STATESiiiiiiiiTHE 
FIRST  ELEMENT  OF  THE  STRING  IS 
THE  LOCATION,  THE  SECOND  IS  IF 
IT  HAS  NOT  BEEN  GUESSED  (0)  OR 
IE  IT  HAS  BEEN  GUESSED  (1) ,  THE 
REURINOER  OF  THE  STRING  IS  THE 
NAME  OF  THE  STATE. 

9880  DIM  R$(5©,16) 

9010  LET  A$ { 1) ="30ALABAMA“ 

9020  LET  A* (2) ="00RLASKA" 

90o0  LET  A* (3) ="20ARIZONA" 

904-0  LET  R$  (4.)  ="80ARKRNSAS" 

LET  A  *  (  5  )  = " 10CAL IFORN IA " 
9060  LET  A* (6) =“90COLORADO" 

9070  LET  A$  (7)  ="4-0CONNECTICUT" 
9080  LET  A$  (8)  ="40DELAWARE" 

J-ET  AJ  (9)  =“30FLORIDA" 

9100  LET  A*  (  10)  ="4-0GEORGIA" 

9110  LET  A$(11)="00HAWAII" 

9120  LET  A$(12) ="60 IDAHO" 

9130  LET  A$(13) ="50ILLINOIS" 

014-3  -LET  -R$-(-i4)  ="50 INDIANA" 

9150  LET  A* ( 15) ="S0IOUA" 

9160  LET  A* (16) ="90KANSAS" 

9170  LET  A* ( 17) ="80KENTUCKY" 

®Jg®  FFT  R* (18) ="30LOUISIANA" 

9190  LET  A*  (  19)  ="4-0MAINE" 

9200  LET  A$  (20)  ="4-0MARYLAND" 

9210  LET  A*  (21)  ="4-0MRSSACHU5ETTS 

9220  LET  A* (22) ="50MICHIGAN" 

LET  R* (23) ="50MINNESOTA" 

924-0  LET  A*  (24)  ="30MISSISSIPPI" 
iif?  FIX  R* (25) ="80MISSOURI" 

9260  LET  R* (26) ="60MONTANA" 

9270  LET  A* (27) ="90NEBRASKA" 

9280  LET  A$ (28) ="90NEUADA" 

9290  LET  A* (29) ="40NEU  HAMPSHIRE 

^300  FFT  R* (30) = " 40NEU  JERSEY" 
®310  Fil  R* 131) ="20NEW  MEXICO" 

FiX  fil!<32)="40NEU  YORK" 

9330  LET  A*  (33)  ="40NORTH  CAROLIN, 

93^0  LET  A* (34) ="60NORTH  DAKOTA" 
9350  LET  A* (35) ="50OHIO" 


9360  LET  A* (36) ="90OKLAHOMA" 

9370  LET  A* (37) ="10OREGON" 

R38®  LET  R$ (38) ="50PENNSYLUANIA" 
9390  LET  A* (39) ="40RHODE  ISLAND" 
9400  LET  A$ (40) ="40SOUTH  CAROLIN 

9410  LET  A$(41) ="90SOUTH  DAKOTA" 
9420  LET  A$ (42) ="80TENNESSEE" 
9430  LET  A* (43) ="20TEXAS" 

9440  LET  R$ (44) ="90UTAH" 

9450  LET  A* (45) ="60UERMONT" 

9460  LET  A* (46) ="40UIRGINIA" 

947®  LET  A* (4?) =" 10WASHINGTON" 
9480  LET  A* (48) ="70WEST  VIRGINIA 

949®  LET  A* (49) ="50UISCONSIN" 
9500  LET  A$ (50) ="90 WYOMING" 

9510  RAND 

9520  REM  HOW  MANY  TIMES  YOU  HAVE 
MISSED  THE  QUESTION 
9530  LET  A =0 
9540  REM  HOW  MANY  RIGHT 
9550  LET  5=0 
9560  REM  HOW  MANY  WRONG 
9570  LET  C=0 

9580  REM  HOW  MANY  STATES  HAS  THE 
PLAYER  BEEN  ASKED  TO  MATCH 
9590  LET  D  =  1 
960©  REM  NO  NAME  YET 
9610  LET  E  =0 
9620  RETURN 

SYNTACTIC  SUM:  20220,  8K  ROM 


We  will  pay 

CASH 

for  non-exclusive  rights  to 
manufacture  and  sell  your 
Timex/Sinclair  educational  and 
entertainment  programs. 


DALLAS  DEVELOPMENT  SYSTEMS 
7410  Stillwater 
Garland,  Texas  75042 
(214)  238-1776 


SYNTAX  QUARTERLY/SPRING  1983 


21 


SOFTWARE— UTILITY 

by  Dan  Platt,  Edinboro,  PA 


8K  ROM/4K  RAM 


POKEing 
Directly  To  The 
Display  File 


In  SYNTAX  newsletter  (Nov.  81)  a  neat  games  pro¬ 
gram  appeared  called  “MONXZER”  (revised  version 
Winter  82  issue  of  SQ).  But  the  graphics  are  sooooo 
slooooow  and  take  up  sooooo  much  memory.  How  can 
we  avoid  this  tremendous  memory  consumption  and  de¬ 
lay  with  graphics? 

First,  it  isn’t  necessary  to  directly  use  PRINT  or  PLOT 
statements.  You  can  write  directly  into  the  display  file, 
the  place  in  memory  where  the  computer  stores  the  infor¬ 
mation  to  be  shown  on  the  screen. 

Try  this: 

POKE  PEEK  16396  +  256* PEEK  16397  +  114,23 

An  asterisk  should  appear  near  top  center  of  your  screen . 
(I  will  explain  why  later) .  The  display  file’s  memory  seems 
to  be  set  up  as  follows: 

Enter  (Code  118)  32  bytes  of  text 

Enter  32  bytes  of  text 

Enter  32  bytes  of  text 

Enter  32  bytes  of  text,  etc. 

Using  the  enter  symbol  as  the  first  byte  of  each  line 

seems  to  key  the  video— without  it  the  screen  goes  crazy. 
So  you  shouldn’t  write  (POKE)  into  these  locations.  To 
count  out  where  to  POKE  a  variable,  add  33  for  each  line 
past  the  first  ENTER  (code  118)  plus  the  number  of  char- 


we  may  use  (you  guessed  it)  machine  coding!  It  is  much 
faster,  and  memory  economical.  Consider  the  following 
program: 

LD  HL,  (16396)  ; first  location  for  D _ FILE 

LD  BC,81  ; first  position  2nd  row,  15th  col. 

LD  A, 23  ;23  is  code  for  symbol  * 

ADD  HL,BC  ;HL  points  to  2nd  row,  15th  col. 

LD  (HL),A  ;put  in  * 

LD  BC,33  ; displacement  for  1  row. 

ADD  HL,BC  ;next  row 

LD  (HL),A  ;put  in  next  * 

ADD  HL,BC  ;next  row 

LD  (HL),A  ;put  in  next  * 

ADD  HL,BC  ;next  row 

LD  (HL),A  ;put  in  next  * 

RET  ;go  back  to  main  program 

You  can  load  this  routine  into  a  REM  statement  at  line 
1.  (See  also  Machine  Code  Programs  — Where  and  How 
to  Load  Them  by  William  Wentz,  SQ,  Winter  1982.)  Enter 
1  REM  AAAAAAA.  .  .  (three  rows  are  enough).  Then 
POKE  the  following  values  in  numerical  order.  For  exam¬ 
ple,  type  POKE  16520,42  then  press  ENTER  or  NEW- 
LINE.  Then  type  POKE  16521,12  and  press  ENTER  and 
so  on.  Don’t  put  any  line  numbers  before  the  POKEs. 


acters  (columns)  over  to  be  displayed. 


CO  «M6520,42 


You  may  find  the  location  of  the  first  “Enter”  by  look-  16521  12 

ing  into  the  system  variable  D FILE  (memory  pair  16522  64 

16396  and  16397) .  Thus,  we  POKE  the  asterisk  (symbol  16523  1 

23  in  the  character  set  table)  into  the  third  row  3  x  33  and  tD  16524' 8 
the  15th  column.  The  two  PEEKs  tell  the  computer  n 


16524,81 

16525,0 


where  to  look  for  the  start  of  the  display  file.  Adding  ^  *  16526  62 
3*33  +  15,  or  114,  tells  it  to  move  to  the  third  row,  15th  ^^^16527*23 
column.  So  the  location  to  POKE  the  asterisk  symbol  16528  9  ^ 


column.  So  the  location  to  POKE  the  asterisk  symbol  16528  9  16539  2< 

given  by:  fJTLj  A  16529|llS\ 

PEEK(16396)  +256*PEEK(16397)  +3*33  + 15  £.O0C.  16530,1  \ 

I  don’t  recommend  using  PEEKs  and  POKEs  for  speed  t,  ,  ... 

hpn  pntpr  thiQ  li np* 

and  certainly  not  for  memory  conservation.  However, 

they  do  demonstrate  how  to  get  into  the  display  file.  Now  10  LET  A  =  USR  16520 


16531,33 

16532,0 

16533.9  * 

16534.119 

16535.9 

16536.119 

16537.9 

16538.119 
16539,201 


22 


SYNTAX  QUARTERLY/SPRING  1983 


Four  asterisks  will  appear  very  fast  (even  in  SLOW  mode) 
when  you  RUN  this  two-line  program. 

I  recommend  learning  how  to  use  machine  code  for 
these  kinds  of  problems.  Check  out  TRS-80  Assembly 
Language  Programming  by  William  Barden  for  a  discus¬ 
sion  of  various  techniques  (useful  for  any  assembly  or 
machine  language)  and  Z80  Users  Manual  by  Joseph  J. 
Carr  for  a  more  detailed  discussion  of  the  instructions. 
(Look  out!  His  codes  in  binary  aren’t  always  correct! 
These  are  contained  in  the  back  of  the  TRS-80  text.) 

Lastly,  we  may  look  at  the  pixels  and  how  to  address 
them  in  machine  code.  Each  character  block  on  the 
screen  is  split  up  into  four  segments.  If  we  label  bits  from 
least  to  most  significant  beginning  with  one: 

_  87654321 

00000000 

We  see  that  all  zeros  are  blank  (white) ,  a  1  in  bit  one  turns 
on  (blackens)  the  upper  left  hand  corner,  the  second  bit 
the  upper  right,  and  the  third  the  lower  left. 


We  thus  see  that  the  addressing  used  by  the  PLOT  in¬ 
struction  is  somewhat  more  complicated  than  at  first 
glance.  Also,  if  you  know  what  symbols  go  where  (not 
doing  mathematical  graphs),  you  just  need  to  store  them 
in  a  table  and  use  a  machine-coded  segment  to  place 
them  in  position. 

In  closing,  I’d  like  to  indicate  that  1)  machine  code  isn’t 
complicated;  2)  it  is  tedious;  3)  it  is  very  fast;  4)  it  is  very 
memory  efficient;  and  5)  some  programming  problems 
involving  graphics  display  are  best  solved  with  machine 
coding. 


=  00000000 


E 

3 


=  00000001 


=  00000010 


=  00000100 


We  can  form  graphics  symbols  by  darkening  combinations 
of  pixels: 


=  00000011 


If  you  wondered  what  happened  to  the  lower  right  hand 
pixel,  it’s  coming  right  up.  We  may  form  an  inverse  image 
by  putting  a  1  in  bit  8: 


(Ed.  note:  This  program  requires  4K  RAM  or  more  to 


B  GENERAL  SYSTEMS  CONSULTING 

2312  Rolling  Rock  Drive 
Conley,  Georgia  30027 
SINCLAIR  ZX81  and 
TIMEX  SINCLAIR  1000  SOFTWARE 
16K  minimum  configuration 
Designed  to  help  monitor  your  finances. 

1.  Amortizations . 9  95 

2.  Bar  Charts . 9  95 

3.  Annuity  Evaluation . .  9  95 

4.  File  Manager . 9.95 

5.  Bank  Statement  Balancer . 9  95 

6.  Checkbook  Simulator  . 9.95 

7.  Depreciation  Straight  Line . 9.95 

8.  Depreciation  Declining  Balance . . i  . .  9.95 

9.  Depreciation  (ACRS) . . ...  9.95 

10.  Diet  Plan . \ . .  9  95 

11  Home  Budget  . 9  95 

12.  Home  Inventory . 9.95 

13.  Home  Payables . 9.95 

14.  Home  Equity  Evaluation . 9.95 

15.  Real  Estate  Investing . 9  95 

16.  Savings/Investments  Analysis . 9.95 

17.  IRS  1040  (Long  Form) . .  9  95 

18.  IRS  1040 A  (Short  Form) . 9.95 

19.  Income  Tax  Projections . 9.95 

Circle  selections  and  fill  out  form  beiow: 

123456789  10 

11  12  13  14  15  16  17  18  19 

Number  of  items  selected _ (5)  9.95  . . 

Postage/Handling  1.50 . . 

Total:  _ 

NAME _ _ _ 

ADDRESS  _ _ 

CITY/STATE/ZIP _ _ 


SYNTAX  QUARTERLY/SPRING  1983 


23 


SOFTWARE— MATH 

by  R.A.  Woodall,  Laughlintown,  PA 


8K  ROM/16K  RAM 


Simultaneous  Linear 
Equations  and 
Matrix  Inversion 


Solves  simultaneous  linear  equations  or  inverts  an  N*N 
matrix  by  forward  and  backward  row  reduction.  A  delight 
for  amateur  mathematicians. 


Given  a  simple  system  of  linear  equations,  for  exam¬ 
ple,  if  X  +  2Y  =  5  and  X  =  2,  find  X,  your  favorite 
junior  high  school  whiz  would  no  doubt  arrive  at  the  cor¬ 
rect  answer  before  you  could  even  find  the  tape  to  load 
your  computer.  But  as  the  size  of  the  problem  grows  to 
involve  more  than  about  three  variables,  the  solution  can 
become  quite  tedious  and  prone  to  error.  There  is  also 
the  chance  that  after  much  arithmetic  you  will  find  that  no 
unique  solution  to  the  problem  exists.  So  if  you  have  say 
a  10  by  10,  you  can  bet  that  your  ZX/TS  will  beat  any 
pencil  pusher  several  times  over. 

Matrix  algebra  is  a  little  more  complex,  but  the  row 
reduction  method  is  essentially  the  same  as  for  simultane¬ 
ous  equations  and  it  is  convenient  to  include  both  in  one 
program.  I’ll  not  even  begin  to  explain  why  one  would 
want  to  invert  a  matrix,  but  matrix  inversion  is  rather  akin 
to  taking  the  joint  reciprocal  of  a  specific  array  of  num¬ 
bers.  If  you  multiply  the  inverted  matrix  by  the  original 
matrix,  you  see  the  operation  is  similar  to  the  simple 
1/X*X  =  1. 

To  use  this  program,  just  type  it  in  and  RUN.  It  is  fully 
prompted,  so  just  enter  the  correct  responses.  The  pro¬ 
gram  starts  by  asking  for  the  type  and  size  of  problem, 
sets  appropriate  dimensions  and  prompts  the  necessary 
input.  I  calculate  that  16K  RAM  will  handle  at  least  a 
25  x  35  matrix  or  about  50  simultaneous  linear  equa¬ 
tions.  During  input  the  coefficient  matrix  is  augmented  as 
necessary  by  either  the  output  matrix  for  equations,  or  an 
identity  matrix  for  inversion.  You  can  make  corrections 
after  entering  all  data.  To  exit,  just  answer  N  after  your 
problem  is  solved. 

Forward  row  reduction  proceeds  by  stepping  across 
the  columns  and  down  each  row  (along  the  diagonal), 
selecting  at  each  step  a  sub-row  suitable  for  reducing  each 


10  PRINT  “THIS  PROGRRM  SOLVES" 
2©  PRXNT  "SIMULTANEOUS  LINEAR” 
30  PRINT  "EQUATIONS  (E)  OR" 

4-0  PRINT  "INVERTS  AN  N*N  MATRI 
X  C  13  " 

SO  PRINT 

S©  PRINT  "WHICH  ONE ,  (E)  OR  (I 


7©  INPUT 
S0  PRINT  Q$ 

O©  IF  ©$="E"  THEN  LET  H=1 
10©  IF  ©$="I"  THEN  LET  H=2 
110  IF  Mol  AND  M<>2  THEN  GOTO 
60 

120  PRINT 

130  PRINT  "GIVE  SIZE?  "; 

14©  INPUT  N 
IS©  PRINT  N 

1S0  IF  M=1  THEN  LET  M=N+1 
17©  IF  M=2  THEN  LET  M=2*N 
180  DIM  X(N,M) 

190  SCROLL 

2©@  PRINT  "ENTER  COEFFICIENTS" 
205  SCROLL 

218  IF  M=N  +  1  THEN  PRINT  "AND  OL 
Tpirr  ARRAY" 


220  SCROLL 

230  PRINT  "RQU  COLUMN" 

24-0  SCROLL 

250  FOR  R=I  TO  N 

260  FOR  C=1  TO  N 

27©  PRINT  "  " ; R; TAB  8; C , 

288  INPUT  X*R,C) 

200  PRINT  X (R, C) 

205  SCROLL 
30©  NEXT  C 

310  IF  MoN  +  1  THEN  GOTO  380 
33©  PRINT  "  " ; R; "  OUT", 

350  INPUT  X  <  R , H  3 
3S0  PRINT  X(R,M) 

370  GOTO  30© 

380  LET  X (R , N+R3  =1 
300  SCROLL 
4-08  NEXT  R 
4-18  SCROLL 

4-20  PRINT  "ANY  CORRECTIONS  CY3  7 


430  INPUT  Q$ 

44©  IF  Q$<>"Y"  THEN  GOTO  508 
45©  SCROLL 

4S©  PRINT  "WHICH  ROW? 

47©  INPUT  R 
48©  PRINT  R 
40©  SCROLL 


Continued  Next  Page 


24 


SYNTAX  QUARTERLY/SPRING  1983 


50©  PRINT  “ WHICH  COLUMN  {OUT  IS 
N  +  l)  *? 

510  INPUT  C 
520  PRINT  C 
530  SCROLL 

54-0  PRINT  "ENTER  UflLUE?  "  : 

550  INPUT  X (R,C) 

560  PRINT  X (R, C) 

5S0  GOTO  4-1© 

59©  CLS 

60©  REM  FORWARD  EL IMINRT ION 
61©  FOR  C  =  1  TO  N  —  1 
62©  LET  A=© 

630  IF  X{C,C)  <  >©  THEN  GOTO  "730 

64-0  FOR  R=C  +  1  TO  N 

650  IF  X (R,C) =0  THEN  GOTO  720 

66©  FOR  1=1  TO  M 

670  LET  T  =  — X  iR,Ii 

680  LET  X tR . I) =X (C, I) 

69©  LET  XCC.I)=T 
700  NEXT  I 
710  GOTO  73© 

72©  NEXT  R 

730  LET  R=XiC,Ci 

74-0  IF  R=0  THEN  GOTO  124-0 

750  FOR  R=C+1  TO  N 

760  LET  B=X(R,C) /fl 

770  IF  B=0  THEN  GOTO  81© 

780  FOR  I=C  TO  M 

III  Nl^TXiR  IJ  =X{R'I)  -B*X(C,I) 

810  NEXT  R 
82©  NEXT  C 

830  REM  CHECK  DETERMINATE 

84-0  LET  D  =  1 

350  FOR  1=1  TO  N 

860  LET  D=D*X(I,I) 

87©  NEXT  I 

880  IF  D=0  THEN  GOTO  1240 
890  REM  BRCKURRD  ELIMINATION 
9©0  FOR  C=N  TO  2  STEP  -1 
910  LET  A=X (C,C) 

920  FOR  R=C-1  TO  1  STEP  -1 
930  LET  B=X (R,C) /A 
94©  FOR  I=C  TO  M 

III  nIxt*!^1*  =XtR'I>  ~B*XtC,I> 

970  NEXT  R 
980  NEXT  C 

990  REM  PRINT  RESULTS 
100©  IF  M=2*N  THEN  GOTO  110© 

1010  PRINT  "THE  INPUT  ARRAY  IS  " 

1020  PRINT 

1030  FOR  1=1  TO  N 

<ltl)PRINT  =  "iXtI,M)/X 

1050'  NEXT  I 
1060  GOTO  118© 

| 10®  PRINT  "THE  INUERTED  MATRIX 
11 1©  PRINT 

1120  PRINT  "ROW  COLUMN- 
1130  FOR  R  =  1  TO  N 
1135  PRINT 
1140  FOR  C=1  TO  N 

f 15®  PRINT  "  "JR; TAB  7JC,XCR,N+C 

*  /  X  (  K  .i  R  J 

1160  NEXT  C 
1170  NEXT  R 
118©  PRINT 

1190  PRINT  "DETERMINATE  IS : " , D 
1200  PRINT 

1205  PRINT  "RUN  AGAIN  (YJ  ?" 

121©  INPUT  0$ 

1215  CLS 

122©  IF  Q*="Y"  THEN  RUN 
1230  STOP 

1S40^PRINT  "SINGULAR  COEFFICIENT 

1250  PRINT  "NO  UNIQUE  SOLUTION" 
1260  GOTO  120© 

SYNTACTIC  SUM:  58033,  8K  ROM 


other  sub-row,  moving  the  entire  row  to  the  top  of  the 
sub-matrix  if  necessary,  and  performing  the  reduction.  If 
the  computer  finds  a  row  it  cannot  handle,  the  program 
recognizes  the  singularity  of  the  coefficient  matrix  and 
stops.  Completion  of  the  forward  reduction  sequence 
produces  an  upper  triangular  coefficient  matrix  and  its 
determinant  is  found  as  the  product  of  the  diagonal 
elements. 

If  the  determinant  is  not  zero,  the  system  can  be 
uniquely  solved  and  backward  elimination  proceeds  in  a 
manner  similar  to  the  forward  steps.  Upon  completion 
the  answers  are  found  by  dividing  each  row  element  of 
the  augmented  matrix  (which  has  been  similarly  operated 
upon)  by  the  diagonal  coefficient  in  the  same  row.  The 
computer  then  prints  the  answers  in  logical  sequence,  but 
larger  problems  will  require  CONTinues  when  the  screen 
is  full.  Finally,  the  determinant  is  printed  and  you  can  re¬ 
run  the  program. 

Since,  as  usual,  one  “keypunch”  error  can  throw  the 
whole  program  into  a  cocked  hat,  I  include  a  couple  of 
test  examples  after  the  program  listing  as  well  as  a  practi¬ 
cal  example  of  the  use  for  simultaneous  equations.  Have 
fun! 

Simultaneous  Equations: 

Suppose  you  have  four  programs,  each  containing  a 
number  of  PAUSE  statements  (P),  several  loop  (L)  state¬ 
ments,  several  other  operational  program  lines  (O),  and 
(N)  characters  to  be  printed.  You  time  the  completion  of 
each  program  and  solve  for  the  time  each  element  takes. 
You  can  then  use  the  answers  to  predict  how  long  similar 
programs  will  take  to  run. 


Prog 

*  P 

L 

N 

O 

Time  (sec) 

1 

15 

26 

18 

31 

6.2 

2 

28 

17 

15 

23 

5.4 

3 

19 

42 

7 

36 

2.9 

4 

11 

21 

12 

19 

4.2 

The  answers 

are:  X-l 

= 

.017664834 

sec. 

-2 

= 

.011355478 

-3 

= 

.32093198 

-4  =  .0044190484 

Matrix  Inversion: 

The  following  matrix  is  singular:  4  1  2  6 

1  2  4  1 

0-1-21 

0  6  12  0 

The  inverse  of  the  matrix:  1  0  1  is  0  0  1 

3  10  0  1-3 

100  10-1 

SQ 


SYNTAX  QUARTERLY/SPRING  1983 


25 


j=^i  SOFTWARE— HOME/BUSINESS _ 

by  Michael  Roberts,  Des  Moines,  IA  8K  ROM/16K  RAM 


ZX/TS 

Home 

Budget 


One  of  the  first  applications  that  come  to  mind 
when  you  get  a  personal  computer  is  managing 
your  home  finances.  However,  when  1  got  a  copy  of 
Sinclair’s  Home  Budgeter,  I  was  disappointed.  It  was  fast, 
with  good  displays,  but  difficult  to  follow  and  modify.  It 
seemed  to  do  the  wrong  things.  I  wanted  a  program  to 
keep  track  of  my  monthly  expenditures  in  a  variety  of  ac¬ 
counts  as  well  as  annual  totals  for  expenditures  by  item 
and  as  a  whole.  This  Budget  version  resulted. 

Type  in  Home  Budget  as  listed.  Before  using  it  the  first 
time,  save  blank  copies  on  tape  by  entering  RUN  9900. 
These  copies  are  self-running  from  then  on. 

To  use  Home  Budget,  just  follow  the  prompts.  The 
prompts  should  be  adequate  to  avoid  errors,  but  most  in¬ 
put  routines  will  check  for  an  invalid  input  and  reject  it.  If 
you  do  manage  to  stop  the  program  for  some  reason, 
you  can  re-enter  without  losing  your  data  by  entering 
GOTO  1.  Do  not  use  RUN  or  you  will  lose  all  your  data. 
To  start  over,  enter  GOTO  100.  It’s  good  to  leave  your 
program  line  cursor  at  line  1,  so  if  the  listing  comes  up  on 
the  screen  you  see  a  reminder  not  to  RUN. 

Home  Budget  handles  up  to  75  differently  named  ac¬ 
counts  of  up  to  12  characters.  When  you  first  set  up  a 
budget,  consider  setting  aside  two  or  three  extra  accounts 
with  no  budget  figures,  in  case  you  want  to  add  an  item 
or  two  to  your  budget  later.  You  can  call  up  accounts  by 
any  unique  part  of  their  name  or  their  number. 

After  you  set  up  your  accounts  the  program  gives  you 
a  menu  (see  Figure  1).  This  menu  accesses  all  the  pro¬ 
gram’s  functions. 

My  version  of  Home  Budget  offers  some  features  you 
may  like  whether  or  not  you  need  the  whole  program.  The 
subroutine  at  lines  10-38  converts  the  floating  point 
variable  M  to  M$,  a  dollar-and-cents  figure  as  we  like  to 
view  it.  If  M  is  negative,  the  routine  at  lines  20-26  changes 
the  string  to  inverse  characters.  Printing  in  inverse  makes 
the  negative  numbers  stand  out  clearly  in  a  list. 

Lines  like  1645  and  1660  provide  another  nice  feature 
throughout  the  program,  right-justifying  the  figures  for 
easier  reading  and  neater  printout. 


BUDGET  NRhE  . 

1:  SUMMRRY  OP  RL.L.  RE-COUNTS 

2:  DETAILS  OF  ONE  ACCOUNT 

3:  ENTER  NEU  INFORMATION 

4-:  CHANGE  R  BUDGETED  AMOUNT 

S:  CHANGE /CORRECT  THE  NAME  OF 
ACCOUNT 

S:  SAUE  THE  PROGRAM 
7:  EXIT  THE  PROGRAM 

LAST  UPDATE:  NEU  TRPE _ 


Figure  1 

I  like  to  run  Home  Budget  as  listed,  but  you  can  get 
faster  results  by  running  your  computer  in  FAST  mode  all 
the  time.  To  run  Home  Budget  in  FAST,  delete  all 
SLOW  and  PAUSE  statements.  Change  lines  like  1695 
to  INPUT  X$. 

Line  1  is  the  Bytes  Remaining  routine  from  SYNTAX 
newsletter,  Oct.  82.  I  like  to  include  it  in  most  programs 
to  see  how  much  memory  is  left. 

Lines  100-345  initialize  and  identify  variables. 

Ed.  note:  For  ease  in  reading  the  listing,  here  are  the  texts 
of  lines  in  inverse  video: 

Line  Text 

2  space  asterisk  space  asterisk  space  DO  NOT 
RUN  space  asterisk  space  asterisk  space 
asterisk  3  spaces  IT  WILL  KILL  ALL 
YOUR  DATA  8  spaces  USE  2  spaces 
“GOTO  1”  2  spaces  TO  RESTART  4 
spaces  COPYRIGHT  (C)  2  spaces  OCT.  7, 
1982  2  spaces  BY  MICHAEL  ROBERTS  - 
DES  MOINES,  IA 


26 


SYNTAX  QUARTERLY/SPRING  1983 


4 


space  TO  BEGIN  A  NEW  FILE  3  spaces 
ENTER  2  spaces  “RUN  100”  16  spaces 
110  ENTER  THE  NUMBER  OF  BUDGET 
ITEMS 

250  ENTER  THE  NAME  OF  THIS  PROGRAM 

1610  ANNUAL  BUDGET  4  spaces  SPENT  TO 

DATE  2  spaces 

1680  “Z”  =  COPY  2  spaces  “C”  =  CONTINUE  2 

spaces  “M”  =  MENU 

1730  MONTHLY  BUDGET: 

1865  OVERSPENT. 

1880  “Z”  =  COPY  2  spaces  “C”  =  CONTINUE  2 

spaces  “M”  =  MENU 

2010  DETAILS  OF  AN  ACCOUNT 

2040  BUDGET/MONTH: 

2350  9  spaces  Z  =  COPY  3  spaces  M  =  MENU  8 

spaces 

2510  6  spaces  NEW  INFORMATION  ENTRY  5 

spaces 

2520  same  as  2510 

2550  (ENTER  “l”OR  “2”) 

2590  (USE  THE  3  LETTER  ABBREV.) 

2680  5  spaces  ANOTHER  ENTRY?  (Y/N)  7 

spaces 

3010  CHANGE  A  BUDGET  FIGURE  FOR 

ACCT. 

3050  (ENTER  “l”OR  “2”) 

3520  PRESENT  NAME: 

3560  NEW  NAME: 

4025  REMEMBER  TO  MAKE  A  “SPARE 

COPY”  1  space 

4550  NOT  SQ 


SYNTAX  QUARTERLY/SPRING  1983 


27 


105©  PRINT  AT  5,2; ”2:  DETAILS  OP 
ONE  ACCOUNT  “ 

1060  PRINT  RT  7,2; *3:  ENTER  NEW 
INFQRMRT ION" 

107©  PRINT  RT  2,2; “4:  CHANGE  R  6 
UDGETED  AMOUNT “ 

1060  PRINT  RT  11,2;  "'5:  CHRNGE/CO 
RRECT  THE  NAME  OF " ; T AB  5; "ACCOUN 


5:  CHANGE/CO 
HB  5; “ RCCuUN 


1065  PRINT  RT 


1  ©2©  PRINT  RT  15,2;  *'6:  5AUE  THE 
PROGRAM  “ 

110©  PRINT  RT  17.2,‘  ”7:  EXIT  THE 
PROGRAM" 

1101  PRINT  RT  19  .  i;  * ' 


11©5  PRINT  TAB  2; "LAST  UPDATE:  “ 

;  0$ 

111©  PAUSE  P 

1X20  LET  X$=INKEY$ 

113©  IP  X$  =  "“  OR  CODE  X  $  <  26  OR  C 
ODE  X$>35  THEN  GOTO  111© 

1135  CCS 

114©  GOTO  5  -1-500  ^UAL  X$ 

150©  REM  S  ^SUMMARY  *  * 

1510  PAST 
152©  DIM  5 (Nl) 

1525  DIM  T  (  14- ) 

153©  FOR  1=1  TO  Nl 
1535  FOR  «J  =  2  TO  13 
154-©  LET  5(1)  =5(1)  +D(I,J) 

154-5  NEXT  U 

155©  NEXT  I 

1560  FOR  1=1  TO  13 

1565  FOR  <J=  1  TO  Nl 

157©  LET  T(I)=T(I)  +D(J#I) 

1575  NEXT  U 

156©  IF  I>1  THEN  LET  T  (  14- '!  =T  (  14- } 
+T  (I) 

1565  NEXT  I 
1590  SLOU 

1600  FOR  1=1  TO  Nl  STEP  G 

1605  FOR  U=©  TO  9  _ 

1610  IF  U=©  THEN  PRINT  AT  0,©; "S 

1515  IF  J  +  I>N^MENGOT^680 
162©  PRINT  N$(<J  +  I) 

1630  PRINT  TAB  6 
1635  LET  M=i2*D CI+U, 1) 

164-0  GOSUB  G 

164-5  PRINT  TAB  K 15— LEN  M$);M$..** 

1650  LET  M=5(I+d) 

1655  GOSUB  G 

1660  PRINT  TAB  (2S-LEN  H*>  ;  M* 

1670  NEXT  U  _ _ _ 

^6 6 0^ 

1J6 9 0  PAUS^f"  " 

1695  LET  X  $  =  INKEY $ 

17©0  IF  CODE  X$=118  OR  X$=“H“  TH 

EN  GOTO  S 

1705  IF  X$="2"  THEN  PRINT  AT  21, 

0;  " 

1710  IF  X$=“Z“  THEN  COPY' 

1715  IF  X$=“Z“  THEN  GOTO  1660 

1720  CLS 

1725  NEXT^  I  ■  HI  II  II  ■ 

1735  LET  M=T(1) 

174-0  GOSUB  G 

174-5  PRINT  H$ 

1750  PRINT 

1755  PRINT  “SPENT  IN “ ;  TAB  12;  “AM 
OUNT “ ; TAB  20; “ “ “ + “ “ =B AL ANCE “ ; T AB 
0; “MONTH  OF “ ; T AB  12; “SPENT “; TAB 
20 ;  - " “B“  “ =DEP IC IT “ 


1757  PRINT 

1760  FOR^2  TO  13 
1765  LET  M=T(I> 

1770  GOSUB  G 

1775  PRINT  TAB  2 ; O* ( C 1-2) *3+ 1  TO 
( 1-2) #3+3) ; TAB  10; "$";TAB  (19-L 

EN  M$)  ;  M*; 

1760  LET  H=T(1)-UAL  M$ 

1765  GOSUB  G 

1766  IF  M  >  =0  THEN  PRINT  TAB  20;  “ 

1787  IF  M  <0  THEN  PRINT  TAB  20;  "E 

1790  PRINT  TAB  (31-LEN  . MS 

1795  NEXT  I 
1799  LET  T=© 

1600  FOR  1=2  TO  13 
1605  LET  T=T+TCIi 
1310  NEXT  I 

1820  PRINT  , , “TOTAL  ANNUAL  BUDGE 
T: 

1825  LET  M=X2*T(1> 

1330  GOSUB  G 

1835  PRINT  TAB  (31-LEN  M$) ; M$ 
1S4-©  LET  M=T 
134-5  GOSUB  G 

1850  PRINT  “TOTAL  SPENT  TO  DATE: 

$“;TAB  (31-LEN 
1655  LET  M=12*TC1)-T 

I860  IF  M  >  =©  THEN  PRINT  “BALANCE 
LEFT : “ , 

1865  IF  M  < 0  THEN  PRINT  mfeMggl 


1670  GOSUB  G 

1875  PRINT  TAB  21;“$“;TAB  (3I-LE 
ISsl^RINT  RT  =>i  ______ 

1395  LET  X  *  =  INKEY & 

190©  IF  CODE  X$=118  OR  X$=“M“  TH 
EN  GOTO  I©©© 

1905  IF  X$=“Z“  THEN  PRINT  AT  E . © 


1910  IF  X$=“Z“  THEN  COPY 

1915  IF  X$=“Z“  THEN  GOTO  I860 

1920  GOTO  S 

2000  REM  * ^ANALYSIS S* 


2020  GOSUB  L 

2030  PRINT  Y$ _ 

204-0  print  t  BHaBBaKaam 

204-5  LET  H=DCY%±> 

205©  GOSUB  G 

2055  PRINT  M$ 

2056  PRINT 

2©60  PRINT  “MONBAMT  SPEf 
CElfiCCUM  BAL “ 

2070  PRINT  L$ 

2S75  LET  T=DCY'.15 
2076  LET  %J  =© 

203©  FOR  1=2  TO  13 
209©  PRINT  Q$C(I-2)*3+l 


BALANl 


2075 

2076  I 
2©30 
209© 
*3+3) 
2100 
2105 
2110 
2120 


2100  LET  M=DCY.I> 

2105  LET  U=U+M* 

2110  GOSUB  G 

2120  PRINT  TAB  12-LEN  H$;M$; 

2130  LET  M=T-D(Y',X) 

214-0  GOSUB  G 

215©  IF  M>=©  THEN  PRINT  TAB  13;“ 
+  “  t 

216©  IF  M<©  THEN  PRINT  TAB  13; “E 

2160  PRINT  TAB  22-LEN  M$;M$; 

2185  LET  M  =T  *  (  I - 1 )  -U 

Continued  Next  Page 


28 


SYNTAX  QUARTERLY/SPRING  1983 


2190  IF  M<0  THEN  PRINT  TRB  23; 

a 195  IF  M>=©  THEN  PRINT  TRB  23 

+"; 

2200  GOSUB  G 

221©  PRINT  TRB  32-LEN  M*; H* 
2215  NEXT  I 

2219  PRINT 

2220  PRINT  "RNNURL  BUDGET: " ."t 
2225  LET  M=T*12 

2230  GQ5U5  G 

224-0  PRINT  TRB  25-LEN  M$:M$ 
2250  PRINT  •‘SPENT  TO  DRTE: 

2250  LET  M=U 
22?©  GOSUB  G 

2280  PRINT  TRB  25-LEN  M$;MS 
2290  PRINT  "BRLRNCE;", 

2300  LET  M=T*12-U 
2310  IF  M>=0  THEN  PRINT  "+"; 
2320  IF  M  <0  THEN  PRINT  "H"  . 
2330  GOSUB  G 
234.0  PRINT  TRB  25-LEN  M 
2350  PRINT  RT  21.0; 


2360  PRUSE  F 
2365  LET  Y*=INKEY* 

2375  IF  Y*  =  **Z"  THEN  COPY 

§380  IF  Y*="Z"  THEN  GOTO  2350 

2390  CLS 

24-00  GOTO  S 

2500  REH  **NEU  INFO** 

2505  CLS 
2510  PRINT 


E 
X 

F  X* 
2555 
ET  X 
R 
R 
R 


2600  INPUT  Y* 

2505  FOR  1=0  TO  11 

?6THENFGOTO°*6a!*3>  +1  T° 

2515  NEXT  I 

2520  PRINT  “UHRT?" 

2621  GOTO  2590 
2625  LET  1=1+2 

ft?™  “ENTER  THE  RHOUNT :  " 

264-0  INPUT  <J 

2650  IF  U  <0  THEN  GOTO  2590 
2660  IF  X  =2  THEN  LET  J=-U 
2670  LET  D  (Y  ,  I)  =D  (Y  .  I)  +U 
2680  PRINT  RT  21.0;  *'*| 


2690  PRUSE  F 

270©  IF  INKE>'*  =  "Y"  THEN  GOTO  25© 

2710  GOTO  S 
2990  STOP 

3000  REH  *  *CHRNGE  BUDGET  FIGURE* 
3005  GOSUB  L 
3010  PRINT 


?S^LPRINT  *  '  “  1  «  NEW  MONTHLY  F 

I IGURE  ,T RB  14-;  •*  OR  ** 

iNNURL^OTRL"2  R  CHRNGE  IN  T«E  « 
1 3050  PRINT  TRB  6; 


3060  PRUSE  F 
3070  LET  X$= INKEY  $ 

3075  IF  X$  <>"1**  RND  X*<>**2"  THEN 
GOTO  3070 
3080  LET  X=URL  X* 

3090  PRINT  "ENTER  THE  RHOUNT  •  " 
3100  INPUT  <J 

3110  IF  X  =  1  THEN  GOTO  3200 

3120  LET  J=J/12 

3130  LET  <J=  INT  (0*100)  X100 

si*®  EET  D  <Y  *  1}  tY  ■• 

3 150  GOTO  S 
3200  LET  D  (Y  ,  1) =U 
3205  GOTO  S 

3500  REM  **CHRNGE  NRME  *  * 
3505ePRINTs"TO  CHRNGE  RN  RCCOUNT 

3510  GOSUB  L 

3520  PRINT  ••  Y* 

3530  PRINT  , , "ENTER  THE  NEU ' NRME 


354-0  INPUT  Y* 

3550  LET  N*  CY  .4-  TO  >  =Y* 

3560  PRINT  ■  ";Ni(Y) 

3570  PRUSE  250  * 

3580  GOTO  S 
4-000  REM  **SRUE** 

llil  SSI5T  oiKTER  TOMV'5  DnT=  ■ 

|!!|«|!|^T  ?T.5'0i  -pREpbh^bpc 


TO^TRRT^  RT  al-0;’PRESS  ENTER 

4-035  PRUSE  F 
4-04-0  SftUE  ©$ 

4050  GOTO  S 
4-500  REH  **EXXT** 

4-510  PRINT  “RRE  YOU  SURE  YOU  URN 
T  TO  QUIT  THE  PROGRRH  WITHOUT 

4520^PRUSE  fNEU  IHFORMfiT^" 
4530  IF  INKEY$0"Y"  THEN  GOTO  10 
0 

4-550  PRINT  RT  10..  0;"IF  YOU  CHRNG 
E  YOUR  MIND.  ENTER  ""GOTO  1000” 
*  .  DO  gIS&g  PRESS  RUN .  " 

4560  GOTO  9999 
5000  REM  *  *SERRCH*  * 

e®rccoSntT""ENTER  THE  nrme  of  th 

-5020  INPUT  Y* 

5021  IF  Y*="”  THEN  GOTO  1E3 
5025  FRST 

5030  IF  LEN  V$> 15  THEN  LET  Y*=Y* 
(  TO  15) 

5035  LET  Y=LEN  Y*-l  < 

504-0  FOR  1=1  TO  N1 
5050  FOR  J  =  1  TO  15— Y 

Y$=N$(I,J  TO  U+Y)  THEN  G 
OTO  5100 
5070  NEXT  U 
5080  NEXT  I 

5090  PRINT  "NO  SUCH  NRME  FOUND  - 
TRY  RGRIN" 

5095  GOTO  502© 

5100  LET  Y  =  I 
5110  LET  Y$=Nt(I) 

5120  CLS 
5 125  SLOU 
5130  RETURN 

990©  SRUE  "HOME  BUDGET" 

9905  RUN  10© 

9999  STOP 

SYNTACTIC  SUM:  55339,  8K  ROM 


SYNTAX  QUARTERLY/SPRING  1983 


29 


raj=a]  HARDWARE  INFORMATION 

r-^11  t>  by  John  Andrews,  San  Jose,  CA 


Getting 
Your  Head 
Straight 


If  you’re  not  a  tape  recorder  buff,  you  may  not  know 
the  term  azimuth  as  it  applies  to  recorders.  If  you  do, 
you  may  have  some  inkling  as  to  what  follows.  In  either 
case,  you  may  learn  something  crucial  to  computing  and 
storing  programs  on  tape. 

In  simple  terms,  “azimuth”  is  a  line  of  direction. 
“Azimuth  alignment”  related  to  tape  recorders  refers  to 
the  line  of  direction  of  the  gap  in  the  record  head  pole 
pieces  (or  iron).  Sometimes  you  can’t  see  this  tiny  gap 
with  the  naked  eye,  but  it  is  always  there.  (In  some 
modern  recorders  the  gap  is  filled  with  ceramic  or  other 
material  to  prevent  tape  oxides  from  getting  into  the  gap, 
causing  a  magnetic  short  and  subsequent  loss  of  volume. 
This  problem  can  cause  recording  malfunction.  For  the 
moment,  let’s  stick  with  azimuth  alignment.)  Figure  1  il¬ 
lustrates  a  record/play  head,  locating  the  gap  and 
azimuth. 


I 

I 


I 


Figure  1. 


Note  that  the  gap  runs  vertically  (top  to  bottom)  on  the 
head  at  right  angles  to  the  direction  of  tape  travel.  This  is 
the  crux  of  the  matter.  Just  how  precisely  you  maintain 
this  90-degree  relationship  determines  the  high  frequency 


response  of  the  recordings.  With  voice  recording,  high 
frequency  response  is  not  critical.  With  music,  it  depends 
on  how  important  you  think  it  is  to  hear  the  high  pitch 
tones  in  your  music.  With  computer  data  tapes,  however, 
it  is  crucial  that  high  frequencies  do  not  get  lost.  Com¬ 
puter  data  on  tape  is  all  relatively  high  frequency.  Your 
tape  equipment  must  respond  properly  to  the  high  fre¬ 
quency  signals  from  the  computer  circuits  or  data  will  be 
lost  and  you  will  have  problems. 

So,  right  about  now,  some  of  you  lucky  ones  are  say¬ 
ing  “Well,  that’s  all  very  interesting  but  my  tapes  SAVE 
and  LOAD  fine.  So  why  should  this  concern  me?”  Well, 
here  are  some  reasons  why. 

If  you  never  intend  to  exchange  tapes  with  other 
people,  then  azimuth  alignment  is  not  such  a  concern.  As 
long  as  tapes  are  recorded  and  played  on  the  same 
recorder,  even  with  poor  azimuth  alignment,  the  head 
alignment  appears  good  to  the  tape.  But,  put  that  same 
tape  on  a  recorder  with  different  azimuth  angle  and  the 
high  frequencies  will  be  reduced — maybe  just  slightly  or 
completely  lost.  At  some  point,  you  can’t  load  from  the 
tape  anymore.  Your  ability  to  buy  or  trade  taped  pro¬ 
grams  is  seriously  impaired  unless  everybody  involved 
has  correct  azimuth  alignment  on  their  recorders. 

Also,  if  you  put  off  aligning  your  recorder  head  you  will 
create  a  giant  re-recording  problem  for  yourself.  If  you 
change  your  azimuth  down  the  line  somewhere,  you 
won’t  be  able  to  load  previously  recorded  tapes.  Obvi¬ 
ously  the  best  time  to  check  and  realign  is  as  soon  as  pos¬ 
sible  so  you  don’t  build  up  an  extensive  tape  library  prior 
to  setting  your  heads  straight. 

What  it  boils  down  to  is  this— any  tape  not  recorded  or 
played  back  on  machines  with  correct  (90-degree) 
azimuth  alignment  will  probably  work  poorly,  if  at  all. 

For  best  results,  before  you  proceed  with  alignment, 
clean  and  demagnetize  the  heads. 

Now,  the  question  is,  how  to  align  your  azimuth? 
Several  companies  market  test  tapes  made  specifically  for 
this  function.  The  most  likely  place  to  get  one  is  a  store 
catering  to  audiophiles.  A  test  cassette  typically  provides 
several  recorded  tests,  including  timing,  wow  and  flutter 


30 


SYNTAX  QUARTERLY/SPRING  1983 


as  well  as  azimuth  alignment.  The  alignment  portion  con¬ 
sists  of  several  tones  preceded  by  voice  announcements 
of  their  frequencies.  They  begin  with  relatively  low  tones 
and  increase  with  each  test.  For  example:  test  one  might 
be  a  500-cycle  tone;  test  two,  1000  cycles;  test  three, 
3000  cycles,  and  so  on  up  to  10,000  or  15,000  cycles. 
Flay  a  test  track  on  your  recorder  and  listen  to  the  tones 
after  each  announcement.  If  you  can’t  hear  the  tone  after 
an  announcement  you  have  passed  the  limit  of  your 
recorder’s  high  frequency  response.  If  this  occurs  at  a 
relatively  low  frequency,  say  2000  cycles,  you  have  a 
problem.  If  you  can  hear  5000  cycles  or  above,  you  are 
in  pretty  good  shape. 

Due  to  wide  variations  in  recorder  design,  it  is  impos¬ 
sible  to  cover  all  possible  variations  here,  so  a  general  il¬ 
lustration  will  show  you  where  to  find  pertinent  items  on 
recorders.  You  may  have  to  adjust  your  thinking  to  relate 
the  illustrations  to  your  specific  recorder’s  physical  layout. 
In  this  regard,  the  basic  problem  is  gaining  access  to  the 
adjusting  screw  (E). 

Figures  9  and  10  are  top  views  of  a  typical  recorder 
without  a  cassette  inserted.  Figure  9  shows  how  the 
heads  retract  (dashed  lines)  under  the  housing  top  when 


Figure  9. 


SPINDLES 


or  ® 


CASSETTE  WELL 


NOTCH 


r  ^ 

t-J  -  i.  »  A." 


K 


REC. 

REW. 

PLAY 

F.F. 

STOP 

no  keys  are  depressed.  It  also  shows  the  access  notch  (or 
hole)  to  the  head  adjusting  screw.  Figure  10  shows  how 
the  heads  move  out  into  the  cassette  well  when  you  press 
the  play  key.  When  heads  are  in  this  position  the  ad¬ 
justing  screw  is  accessible  through  the  notch  (or  hole)  in 
the  housing.  On  some  recorders  without  the  notch  you 
reach  the  screw  by  inserting  a  tiny  screw  driver  on  a  slant 
past  the  edge  of  the  tape  well. 

If  on  your  recorder,  you  insert  the  cassette  in  a  trap¬ 
door  and  then  close  the  door  (Figure  11),  there  almost 
has  to  be  an  access  hole  because  the  entire  top  surface 
closes  to  play  the  tape.  Sometimes  a  metal  foil  label 
covers  the  hole.  Peel  up  the  label  to  gain  access. 


Figure  10. 

REC./Play  head 

Erase  head  \  A  . 

^  \  Azimuth 

y  1  adjusting  screw 

r""i 

1 

•  1  •  •!»!  J 

Depressed 

_ V _ 

IBBBDBI 

If  you  find  no  access  to  the  screw  (E),  you  can  do  one 
of  two  things:  remove  the  recorder  housing,  make  the 
adjustment,  then  reassemble  (NOT  recommended  for 
novices);  or  make  a  hole  (this  is  easier,  but  be  careful). 

To  make  a  hole,  locate  the  screw  position  exactly  with 
the  heads  in  play  position  (Figure  10)  and  mark  the  loca¬ 
tion.  Retract  the  heads  (Figure  9)  and  make  a  hole  in  the 
housing  at  the  marked  location .  Use  great  care  not  to  dam¬ 
age  the  head  or  mechanism  in  the  process— do  not  let 
chips  fall  into  the  recorder,  make  them  fall  away  from  it. 

To  adjust  the  azimuth:  play  the  test  track  with  the 
highest  tone  you  can  hear  (test  tapes  come  with  user  in¬ 
structions).  As  it  plays,  adjust  the  tilt  of  your  recorder’s 
head  to  the  point  that  gives  the  loudest  volume.  Then, 
play  the  track  you  couldn’t  hear  before.  If  you  can  hear  it 
now  adjust  the  head  tilt  during  this  track  for  maximum 
volume.  When  you  achieve  the  loudest  volume  on  the 
highest  tone  track  you  can  hear,  you  have  correct 
azimuth  alignment. 


SYNTAX  QUARTERLY/SPRING  1983 


31 


One  note  of  caution.  Don’t  try  to  make  your  own  test 
tape  or  use  a  copy  of  one.  You  can’t  be  sure  of  the  head 
alignments  involved  with  the  copy  recorders  and  a 
misalignment  could  result.  Test  tapes  are  laboratory  stan¬ 
dard  aligned  and  you  must  maintain  this  standard  to 
make  the  concept  work  properly. 

Figure  2,  3,  and  4  illustrate  (exaggerated  for  clarity) 
good  and  bad  azimuth  alignment  as  well  as  typical  head 
mounting  scheme.  These  sketches  show  the  head  as  if 
you  were  inside  the  cassette,  looking  through  the  tape  at 
the  face  of  the  head. 


Head  mounting  flange  A  fastens  to  spacer  post  B  with 
screw  C.  Spring  D  replaces  spacer  post  B  on  the  opposite 
side  of  the  head.  Adjusting  screw  E  up  or  down  against 
the  spring  changes  the  tilt  of  the  head  assembly.  Thus, 
the  azimuth  angle  changes  relative  to  the  tape  edge. 

Adjusting  screw  E  would  normally  not  require  more 
than  a  half  turn  in  either  direction  to  correct  the  azimuth 
alignment.  Usually  a  very  slight  amount  of  turning  will  do 
the  trick— about  one-eighth  of  a  turn  is  ample. 


In  some  cases  spacer  B  and  spring  D  may  be  reversed, 
or  the  whole  setup  may  differ,  but  the  principle  remains 
the  same.  The  manufacturer  also  sets  the  azimuth  the 
same  way  you  do  it.  (Sometimes  they  don’t  do  it  as  ac¬ 
curately  because  they  don’t  expect  a  supercritical  com¬ 
puter  to  look  at  the  signal.) 

Let’s  look  at  the  signal.  Figures  5  through  8  represent 
scope  patterns  of  data  signals  put  on  tape.  In  Figure  5  we 
see  an  ideal  signal  with  a  6  volt  peak-to-peak  level. 
Notice  the  nicely  squared-up  data  bursts  with  an  ampli¬ 
tude  2  volts  peak-to-peak  greater  than  the  4-volt  mini¬ 
mum  the  computer  requires  for  reliable  operation. 


Figure  6  exemplifies  the  same  signal  after  it  passes 
through  a  recorder  with  a  slightly  different  azimuth  align¬ 
ment  from  the  one  used  for  Figure  5.  Note  the  tapered 
beginnings  of  the  top  and  bottom  edges  of  the  signals. 


32 


SYNTAX  QUARTERLY/SPRING  1983 


This  is  known  as  high  frequency  roll-off  and  is  caused  by 
the  inability  of  the  recorder/ amplifier  and/ or  record/ play 
head  to  reproduce  the  abrupt  signal  level  change  of  a 
square  wave  signal.  Notice  the  tapered  part  of  the  signal 
still  exceeds  4  volts,  so  this  amount  of  roll-off  would  not 
cause  data  loss. 

Move  on  to  Figure  7.  This  illustrates  a  more  severe 
case  of  azimuth  misalignment.  The  roll-off  now  reduces 
portions  of  the  signals  below  the  4-volt  level.  Now  you 
lose  data  and  experience  LOADing  problems. 


Figure  8  illustrates  severe  misalignment  resulting  in 
almost  total  loss  of  data  bursts  and  leaving  just  some 
useless  spiking  signals  which  the  computer  ignores. 

Other  problems  also  cause  poor  performance  of  cas¬ 
sette  machine  and  tapes,  such  as  tape  oxide  buildup  on 
head  gap,  and  poor  oxide  coating  on  tapes  and  noisy 
recorders.  These  problems  can  be  overcome  rather  easily. 
However,  if  we  want  to  build  a  ZX80/81  and  Timex 
users  program  exchange  capability  we  need  to  “get  our 
heads  straight”  to  make  it  work  out. 


ov 

Nil 

m 

IB 

dill  4 V  d-d 

■p 

L 

m 

m 

m 

|pp__4V  p  p 

1  6V  p 
-  -1 

Figure  8. 

"IF  I  HAD  TO  CHOOSE 
JUST  ONE  PROGRAM  TO 
IMPRESS  AN  AUDIENCE, 
THEN '3D  MONSTER  MAZE 
WOULD  BE  THE  ONE"*  ^ 


Price  Quantity 

13941  Gamestape  1: 11  Programs—  IK  14.95 _ 

13942  Gamestape  2: 3  Games— 16K  14.95  _ 

13943  Gamestape  3:  Catacombs  Adventure— 16K  14.95 _ 

13944  Gamestape  4: 3D  Monster  Maze—  16K  14.95  _ 

13945  Gamestape  5: 3D  Orbiter— 16K  14  95  _ 

PLUS  BOOKS: 

26025  NOT  ONLY  30  PROGRAMS  FOR  THE  ZX81  14  95  _ 

25957  MACHINE  LANGUAGE  PROGRAMMING  MADE  SIMPLE  19  95  _ 

25913  UNDERSTANDING  YOUR  ZX81  ROM  19  95  _ 

26063  ZX81  ROM  DISASSEMBLY-PART  A  14  95  _ 

26103  ZX81  ROM  DISASSEMBLY-PART  B  14  95  _ 

25895  COMPLETE  BASIC  COURSE  FOR  TS1000/ZX81  34  50  _ 

PLUS  TAPES: 

26446  SPACE  TREK  -16K  14  95  _ 

26359  SUPER  INVASION-1  K  14  95  _ 

26318  WALL  BUSTERS-1K  14  95  _ 

26472  10  EXCITING  PROGRAMS-1K  14  95  _ 

26284  REVERSI— IK  14  95  _ 

26406  TOOLBOX-1  K  14  95  _ 

26490  BASIC  COURSE  2  cassette  pack  7  50  _ 


Total 
$ _ 


3D  MONSTER  MAZE 

Gamestape  4  Actual  screen  TS1000/ZX81 
Orders  to: 

MELBOURNE  HOUSE 
SOFTWARE,  INC. 

Dept.  CS 

347  Reedwood  Drive 
Nashville,  TN  37217 


Signature 


Total:  $ _ _  Name 


Residents  of  CA,  MD,  TN,  please  add  sales  taxes  _  ... 

S&h  2.00  Address 


Enclosed  is  my  check  or  money  order  for  $ _ 

Please  charge  my  Visa _ or  MasterCard 

Card  sr _  expiration  date _ 


Total:  $_ 

Visa  and  M  /  C  orders 
can  be  phoned  in: 

615/361-3738 


City _ State _ Zip _ 

Dealer  orders  and  queries: 

800/251-5900 

(ask  for  a  Melbourne  House  operator)  STX 


SYNTAX  QUARTERLY/SPRING  1983 


33 


8K  ROM/1 6K  RAM 


SOFTWARE— EDUCATION 

by  Dale  F.  Lipinski,  Roslyn,  PA 


Make-It- 

Yourself 

Quiz  Program 


This  program  is  a  do-it-yourself  quiz- writer.  It  lets 
you  choose  the  quiz  format  and  tailor  the  questions 
and  answers  to  the  student’s  level.  You  can  use  Quiz  over 
and  over  for  different  tests. 

Enter  Quiz  as  listed.  Before  running  the  program, 
SAVE  it  on  tape.  This  tape  is  now  your  master  copy. 
Whenever  you  want  to  make  new  quizzes,  just  load  your 
master  tape. 

To  use  Quiz,  just  press  RUN  and  ENTER  (or 
NEWLINE  on  older  machines).  Have  your  questions  and 
answers  ready.  You  may  use  multiple  choice,  true-false, 
or  direct-entry  questions.  To  keep  students  from  cheating 
on  math  problems  by  using  the  computer  to  calculate 
answers,  the  program  requires  the  student  to  solve  math 
problems  before  entry. 

Program  Explanation 

Lines  10  through  300  set  up  the  variables.  Line  230 
calculates  how  many  characters  the  machine  can  devote 
to  your  questions.  The  program  will  use  almost  all  the 
available  memory.  If  you  have  more  than  16K  RAM  and 
don’t  want  to  use  it,  change  line  230  to: 


23©  LET  E=©6©0- +  *5) 


This  change  will  limit  the  program  to  about  16K.  Line 
250  displays  the  number  of  questions  you  requested, 
then  gives  you  the  total  character  count  for  your  ques¬ 
tions.  It  also  tells  you  the  average  number  of  characters 
you  can  use  for  each  question.  This  number  includes  the 
question,  answer,  choices  and  any  explanation  you  wish. 
Use  this  number  as  a  guide  to  plan  your  entries  and  avoid 
running  out  of  memory. 

Lines  310-760  let  you  input  your  questions,  answers, 
choices  and  any  statement  you  want  to  make  to  the  stu¬ 
dent  about  the  question  he/ she  just  answered  incorrectly. 

Lines  770-820  display  the  quiz  title. 

Lines  830-910  start  the  quiz  for  the  student  and  pro¬ 
vide  user-friendly  greetings. 


Lines  920-1150  are  devoted  to  the  quiz. 

Lines  1160-1180  print  the  score.  You  may  wish  to 
comment  here  on  how  well  the  student  did. 

Lines  1190-1240  give  you  the  option  of  saving  the 
quiz  program  on  tape.  It  will  not  retain  the  student’s  name 
or  the  score.  If  you  have  already  saved  Quiz  with  this 
question/answer  set,  press  ENTER  to  go  back  to  the 
beginning  of  the  quiz. 

Quiz  is  a  loop  program.  To  exit  you  have  to  BREAK 
either  at  one  of  the  FAUSEs  or  during  a  false  SAVE 
routine  (you  tell  it  to  SAVE,  but  recorder  is  not  turned 
on) .  If  you  accidentally  BREAK  and  wish  to  continue,  just 
enter  CONT.  If  that  fails,  enter  GOTO  1160.  You  will  be 
able  to  restart  your  quiz  from  the  beginning  without  losing 
your  questions.  If  you  should  BREAK  during  your  ques¬ 
tion  and  answer  input,  try  CONT.  If  that  doesn’t  work, 
you’ll  have  to  start  over  by  entering  RUN. 


(Ed.  Note— When  you  enter  Quiz,  follow  the  spacing  in 
the  listing  exactly.  It  is  important  for  a  nice  display. 
Lines  with  inverse  video  and  graphics  are: 


Line 

Graphics 

.  { 

Inverse  Video 

30 

32  graphic 

ENTER  ANSWER  with 

shift  7 

1  space  on  either  side 

900 

ZX-81  QUIZ  with  1 
space  on  either  side 

1020 

VERY  GOOD  THAT 

IS  CORRECT  with  1 
space  on  either  side 

1060 

I  AM  SORRY  THAT 

IS  NOT  CORRECT 
with  1  space  on  either 
side 

1130 

ENTER  with  1  space 
on  either  side 

1170 

CORRECT  with  1 
space  on  either  side 

34 


SYNTAX  QUARTERLY/SPRING  1983 


After  entering  your  questions  and  answers,  you  can 
BREAK  to  stop  program  execution.  Start  your  tape 
recorder,  then  enter  GOTO  1230.  The  program  will  save 
to  tape  under  the  name  “QUIZ.”  When  you  next  load  the 
tape,  the  program  will  start  automatically  with  the  quiz  at 
line  830.  If  you  BREAK  now  and  look  at  the  program 
listing,  you’ll  see  the  Z  in  QUIZ  (line  1230)  is  in  inverse 
video.  This  is  normal  in  self-starting  programs.) 

List  of  Variables  Used 


DIM  A$(E) 

DIM  A  (A,D) 
B$ 


Stores  all  questions,  answers,  choices 
and  statements. 

Used  to  slice  DIM  A$(E). 

See  program  line  30. 

Sets  up  the  type  of  test. 

Sets  up  the  wrong  answer  explanation. 
Input  information. 

Input  information. 

Explanation  of  wrong  answer. 

Quiz  title. 

Student  name. 

Used  to  compare  correct  answer  to  stu¬ 
dent’s  answer. 

Number  of  questions  (length  of  array  A). 
Number  of  choices  in  multiple  choice 
section. 

FOR-NEXT  routine  counter. 

Depth  of  array  A. 

Length  of  array  A$. 

FOR-NEXT  routine  counter. 

Used  to  calculate  the  length  of  strings. 
FOR-NEXT  routine  counter. 

Score. 

SQ 


An  enhanced  version  of  this  program  is  available  on  C-20 
tape  from  the  author  for  $10.  D  Lipinski  Software ,  2737 
Susquehanna  Road ,  Roslyn,  PA  19001. 

5  REM  "QUIZ” 

10  LET  S=0 

2©  POST  _________ _ — _ 

^^^0CLS  I  » 

S©  PRINT  “UHfiT  TYPE  OF  QUIZ  DO 
YOU  UISH  TOHPUE?%  ,*'I  =  HULIPLE 

CHOICE"  .‘*2  =  TRUE  OR  FRL5E","3 

=  DIRECT  hN5UER‘LB$ 

50  INPUT  C$ 

T0  IF  CODE  C$<=28  OR  CODE  C$>= 
32  THEN  GOTO  4© 

80  CL.  3 

90  PRINT  "HOU  MR NY  QUESTIONS  D 
O  YOU  UISH  TO  RSK7~, , 0$ 

100  INPUT  R 
110  CLS 

ISO  PRINT  "DO  YOU  UISH  TO  EXPLh 


120  PRINT  "DO  YOU  UISH  TO  EXPLh 
IN  THE" , "HN5UER  IF  IT  IS  WRONG?" 
.."I  =  YES",,"©  =  NO",,B$ 

130  INPUT  D$ 

14-0  IF  CODE  D  $  <  =27  OR  CODE  >  = 
30  THEN  GOTO  110 
16©  IF  D$  =  '*©‘*  THEN  LET  H$  =  "  '* 

17©  CLS 
ISO  LET  D=4 

130  IF  C$  =  “2**  OR  C$  =  **3**  THEN  GO 
T  u  c38 


280  PRINT  "UHRT  IS  THE  MflXIHU H 
NUMBER  OF**  ,  "CHOICES  PER  QUESTION 
7", "LIMIT  OF  9**,,B!fi 
210  INPUT  B 

215  IF  B  >  =10  THEN  GOTO  170 
220  LET  D=B+4 

23©  LET  E=  (PEEK  16386-PEEK  1S4-1 

2+256*  (PEEK  16387  —PEEK  16413J-5© 
)  -1300-  (D*  (R  +  l*  *5) 

24-0  CLS 

250  PRINT  "YOU  WILL  HRUE  "  ;  R;  ** 
QUESTIONS'*  ,  "UITH  R  TOTRL  CHRRRCT 
ER  INPUT  OF",E;TRB  0;  *’RN  RUERflGE 
OF  **  ;  E/R  ,  "CHflRflCTERS  PER  QUEST  I 
ON";TRB  0;  **  IF  THIS  IS  OKRY  ENTER 
0**,'*IF  NOT  ENTER  1**,,B$ 

2S0  INPUT  E$ 

27©  IF  CODE  E$<=27  OR  CODE  E$>  = 
29  THEN  GOTO  48 
23©  DIM  flCR+1,0) 

29©  DIM  R*<E* 

30©  LET  RC  1,13=1 
320  FOR  F=1  TO  R 
330  CLS 

34-0  PRINT  "UHRT  IS  QUESTION  NUM 
BER  F;  **'?**  ,  B$ 

350  INPUT  E$ 

355  CLS 

360  PRINT  E$;TfiB  0; "INPUT  ©  IF 

THIS  IS  CORRECT" ."INPUT  1  IF  NOT 
CORRECT**  ,B$ 

370  INPUT  F$ 

330  IF  CODE  F$< =27  OR  CODE  F$  >  = 

29  THEN  GOTO  33© 

390  LET  H=LEN  E$ 

4.0Q  LET  RiF.2)=fi(F.l}  +H 

4-10  LET  R$CR(F,1)  tO  R(F,1)  +H)  = 

4-2©  CLS 

4-30  PRINT  "UHRT  IS  THE  RN5UER?  '* 
4.4.0  IF  Ci  =  !!2"  THEN  PRINT  **  I  =  T 

RUE*  .  .  *0  =  FRLSE *' 

4-5©  PRINT  B  $ 

4-S©  INPUT  E$ 

465  CLS 

47©  PRXNT  E$;TRB  0; "INPUT  0  IF 

THIS  IS  CORRECT" , " INPUT  1  IF  NOT 
CORRECT**  ,B$ 

475  IF  C$  =  "2"  RND  E$  =  **l**  THEN  P 

PINT  RT  0,©;  **  1  =  TRUE- 

477  IF  C$  =  ‘*2**  RND  E  $  =  **©**  THEN  P 

HINT  RT  ©,©;**©  =  FRLSE" 

43©  INPUT 

49©  IF  CODE  F  $  <  =27  OR  CODE  F$>  = 

29  THEN  GOTO  42© 

495  IF  C$  =  ‘‘l**  THEN  LET  E$  =  ** 

**  -+E$ 

500  LET  H=LEN 

51©  LET  RCF,3) =RCF,2) +H 

52©  LET  R$(fiiF,2)  TO  R(F.2) +H) = 

53©  IF  CODE  D$<=28  OR  CODE  D$>  = 

30  THEN  GOTO  60© 

54-8  CLS 

t>t>©  PHiNT  "  UHRT  IS  THE  EXPLRNRT 
ION**  ,  "NO  EXPLRNRT  ION  INPUT  R  5PR 
CE" . B$ 

560  INPUT 

565  CLS 

57©  PRINT  H$;TRB  0; “INPUT  ©  IF 

THIS  IS  CORRECT" ."INPUT  1  IF  NOT 
CORRECT" .6$ 

SB©  INPUT  F  $ 

SO©  IF  CODE  P$  < =27  OR  CODE  PS>  = 

22  THEN  GOTO  54© 

60©  LET  H=LEN 

618  LET  R  CP  ,  4)  =R  (F  .  3>  +-H 

62©  LET  Hf  CR  CF  ..  3i  TO  K  ( F  ,  3)  +H>  = 

638  IF  CODE  C$<=28  OR  CODE  C-$>  = 

38  THEN  GOTO  753 

b  4  S  F  O  H  l_-  =  1  T  G  B 

558  CLS 

660  PRINT  'UHRT  IS  THE  NUMBER  ** 
;C;*'  CHOICE?"  ,  "FOR  NO  CHOICE  INP 
UT  R  SPfiCE" ,B$ 

67S  INPUT  E$ 

Continued  Next  Page 


SYNTAX  QUARTERLY/SPRING  1983 


35 


F$>  = 


7*5© 

769 

7*7© 

789 

THE 

799 

795 

30© 

THIS 


0-71^  q  | _ -r. 

680  PRINT  C;  "  =  l,;E$;TRB  0;  “INP 

UT  ©  IF  THX5  13  CORRECT", “INPUT 
I  XF  NOT  CORRECT" .B$ 

SO©  INPUT  F  $ 

7©0  XF  CODE  F  $  <  =27  OR  CODE  F$  >  = 
29  THEN  GOTO  658 
705  LET  E$-CHR$  (C+28)  +  "  =  "+E?fi 

71©  LET  H=LEN  E$ 

72©  LET  R  (F  ,  4-+C)  =R  CF  .  3+0  +H 
730  LET  R$  (R  CF  ,  3+0  TO  RCF.3+0 
+H5  =5$ 

735  XF  fi$(R(F.2)+l  TO  RCP.3)  ~1) 
=E$(2  TO  )  THEN  LET  R$(RKF  S2>  TO 
R  <F  .,2#  )  =CHR$  CC+23) 

74-©  NEXT  C 

75©  LET  R(F+I,1) =RCF,Di 
7S0  NEXT  F 
77©  CLS 

730  PRINT  "UHRT  XS  THE  TITLE  OF 
THE  QUI2?",B$ 

79©  INPUT  I $ 

795  CLS 

300  PRINT  I$;TRB  0;  "  INPUT  0  IF 
THIS  15  CORRECT"," INPUT  1  XF  NOT 
CORRECT" .B$ 

S 1©  INPUT  F  $ 

320  IF  CODE  F$<=27  OR  CODE  F$ > = 
29  THEN  GOTO  770 
83©  CLS 

34.0  PRINT  "UHRT  IS  YOUR  NRME  PL 
ER 5E?",B$ 

358  INPUT  Ufc 
3S0  CLS 

87©  PRINT  "THRNK  YOU  ";U$;TRB  0 
; "GET  RERDY  FOR  YOUR  QUIZ" 

38©  PRU5E  488 

S90  CLS  _ _ 

900  print  trb  10; 

; TRB  0;I$;TRB  0; "TAKEN  BY  ";U$ 
910  PRUSE  4.0© 

920  FOR  C=1  TO  R 
930  CLS 

94.0  LET  E$=ft$(R(C,l)  TO  ft*C,2>- 

1) 

^94.5  LET  K$=R$(R«C,2)  TO  RCC,3)  - 

950  PRINT  "QUESTION  NUMBER  ";Q. 
TRB  0;  E$;TRB  0;  B$  i  TO  32) 

955  IF  C$  =  ‘T"  THEN  LET  K$=R$ (R  C 
C.,2)  TO  R  CC,  2)  ) 

968  IF  C$  =  "i"  THEN  FOR  1=4.  TO  D 

-1 

978  IF  C$=" 1"  THEN  PRINT  R$ CR (C 
,1)  TO  R  CC  ,  I  +  l)  -1) 

980  IF  C$="l"  THEN  NEXT  I 
990  IF  C$="2"  THEN  PRINT  "1  =  T 
RUE" , , "0  =  FRLSE" 

1008  PRINT  B$ 

101©  INPUT  F$ 

1030  IF  K$=F$  THEN  PRUSE  4-00 
104-0  IF  K$=F$  THEN  LET  5=5  +  1 

1070  PRUSE  4.0© 

1030  CLS 

1093  PRINT  "THE  CORRECT  RNSUER  I 
5";TRB  9;R$(RiC,2)  TO  R(C,3)-1) 
1100  IF  C*="2"  RND  K$="l"  THEN  P 
RINT  RT  1,0; "I  =  TRUE" 

1110  XF  C$="2"  RND  K$="0"  THEN  P 
RINT  RT  1,0; "0  =  FRLSE" 

1120  PRINT  R$iRiC,3)  TO  RiC.4) -1 

) 

1130  PRINT  "PRESS  TO  CON 

TINUE" <5$ 

114-3  INPUT  E$ 

1150  NEXT  C 
1160  CLS 

117©  PRINT  "QUIZ  IS  COMPLETE.  TH 
RNK  YOU",U$;TRB  8,  /‘YOUR  SCORE  X 
S  " ;  s;  "  .  "out  OF  r  pos 

SXBLE  " ; R ; "  QUEST IONS « " ; TRB  ©  ;  "Y 
OUR  GRRD5  RUERRGE  IS  ",5/Ril80;  " 
PER  CENT" 


1130  PRUSE  4-80 

1190  PRINT  RT  15,0; "DO  YOU  UI5H 
TO  5RUE  THIS  PROGRRM1  =  NO",,"© 
=  YES" , ,B$ 

120©  LET  S=© 

121©  INPUT  F$ 

122©  IF  CODE  F $  <  =27  OR  CODE  F$ >  = 
29  THEN  GOTO  33© 

1238  SAVE  'QUIZ" 

124-©  GOTO  83© 

SYNTRCTIC  SUM:  48475,  SK  ROM 


NEW  FROM  SILICON  VALLEY! 

COMPUWIZ  SOFTWARE  PRESENTS: 

Quality  software  for  your 
ZX81/TS1000  computer.  All  at 
LOW,  LOW  prices.  Super 

graphics  and  lots  of  fun! 


1 . 

B  1  ackjac 

o 

i 

X 

...$10, 

.95 

2. 

Masterm i 

i  nd ,  Superm i 

nd 

and  Guess . 

,..$10, 

■  95 

3. 

Escape, 

Snake 

and  The 

Trap . 

,...$8. 

•  95 

4. 

2K  Game 

Pack 

(5  act i on  games)  .  .  . 

,...$9, 

•  95 

5- 

ZX/TS  Quick  Referer 

ice 

Card . . . . 

,...$2. 

.50 

Games  1,  2  and  3  require  16K. 

Send  Check  or  Money  Order  to: 
COMPUWIZ  SOFTWARE,  Box  390078 
Mountain  View  CA,  94039 

Cal.  Res.  please  add  6%  tax. 
SASE  for  list  of  new  products. 
Dealer  inquiries  welcomed. 


EZRA  GROUP  II 
EZRA  GROUP  II 

LOW  LOW  LOW  LOW  LOW  LOW  LOW  LOW  LOW 
PRICES! 

Biorhythms  8K  ROM/lK&up . 1.00 

Graphics  Billboard  8/lup . 1.00 

TAP  WRITER  TM (Handicap  Aid) 8/1. FREE 

Horse  Race  8/lup . 2.00 

SPINNER  TM (like  Rubik • s) 8/16 . . . 2 . 00 

Improved  SLOW  PAUSE . 1.00 

Linear  Regression  8/lup . 2.00 

CHAR.  Generator  Demos  8/lup. i . . 2 . 95 

Plotting  Work  Sheet  8/1 . ...3.95 

Plottinq  Work  Sheet  SLOW/16....6.95 

TRUTH  value  PROGRAMMING . 2.00 

CHEWTER  TM ( like  PACMN) SLOW/16 .. 2 . 95 

ISLAND  SQUARES  TM  SLOW/2 up . 2.00 

Random  MUSIC ISLOW/lup . 2.00 

BASIC  Keyword  Demos  8/1.... from  .50 
ORDER , SASE , reSASE  gets  you  GOO¬ 
DIES  Catalog  and  Program 

EZRA  GROUP  II 
EZRA  GROUP  II 

POB  5222  San  Diego , California  92105 


36 


SYNTAX  QUARTERLY/SPRING  1983 


Join  the 
CLICK ! 

Enter  your  programs  Faster  &  Easier 

with  the  E-Z  Keyboard  . . .  jKjBB SI 

At  last,  a  large  60  key  “Tactile  Feel” 
keyboard  that  plugs  into  the  same  C  Ht-S 

connectors  as  the  existing  keyboard 
on  yourZX81  oryourTimex-Sinclair 

Hear  the  CLICK  and  feel  a  SNAP  for  every  Only 
key  pressed!  (Tactile  Feedback).  . 


sal 


E-Z  Key  60  has  the  following  features: 

-  60  Keys  -  Legends  in  3  colors  on  the  base 

-  Molded  legends  on  key  tops 

-  8  Automatic  shift  keys  (no  shifting  required) 
for  edit,  delite,  single  and  double  quotes, colon, 
semi-colon,  function  and  stop. 

-  2  Shift  keys  -  Numeric  key  pad  -  5"  space  bar. 
E-Z  Key  60  requires  no  wiring  (just  plug  it  in) 
and  can  be  adapted  to  fit  the  XZ80  or  the 
MicroAce  (8  KROM).  The  Mounting  base 
measures  10"x4".  Cables  and  instructions  are 
included. 


KtYTOP  BUTTON 
HINGED  PtUNSCR 
HINGE  ROD 
ROD  STANDOFF 
FILM  SEAL 


SWITCH  SPECIFICATIONS: 

Key  tops  measure  .4"  x  .3''  -  spaced  at 
%"  intervals  between  keys.  Life  =  10 
million  operations,  typical.  Force  =  3. 
oz.  Travel  =  .040".  Dome  switch,  button 
type  with  arm  to  give  .040"  travel. 


A  custom  made  enclosure  (shown  above)  is 
also  available  for  your  computer  and  E-Z  Key 
60  keyboard. 

Measurements:  Price: 

EC-11  11"x9"x3" .  $25.00 

EC-14  14”x9''x3" .  $30.00 


WATCH  FOR  THESE  NEW  PRODUCTS! 

JOYSTICK:  Joystick  kit  that  requires  nowiring 
and  will  fuction  like  the  arrow  keys  &£f  on  your 
computer. 

E-Z  Key  40  Replacement  flat  keyboard  with 
embosing  around  each  switch  and  3  color  legends 
and  graphics  as  existing  keyboard  (plug  in 
replacement). 

Delivery  4-6  weeks.  90  day  warranty. 


E-Z  HEY 


SUITE  75  A,  711  SOUTHERN  ARTERY 
QUINCY,  MASSACHUSETTS  02169 
_ (617)  773-1187 


USE  THIS  ORDER  FORM... 

□  Check  or  E-Z  Key  60 

Money  Order  EC_,1/14 

Charge  to  my: 

□  Visa  □  Mastercard 

Card  #  _ 


E-Z  KEY 

Suite  75  A 

711  Southern  Artery 

Quincy,  MA  02169 


Total  units  S&H  $4  per  unit 
Mass,  res.  add  5%  sales  tax 


SYNTAX  QUARTERLY/SPRING  1983 


37 


HARDWARE  PROJECT 

O""3  JL  J  by  John  Oliger,  Indianapolis,  IN 


8K  ROM/16K  RAM 


Build  Your  Own  EPROM 
Programmer  and  Centronics 
Printer  Interface  —  Part  II 


This  is  Fart  II  of  “Build  Your  Own  EPROM  Program¬ 
mer  and  Centronics  Interface.”  Part  I  (SQ,  Winter  82) 
covered  building  the  expansion  board  and  parallel  printer 
port.  John  Oliger’s  step-by-step  demonstration  in  Part  I 
also  included  etching  printed  circuit  boards,  printer  port 
modification  for  use  with  full  48K  RAM,  decoding  RAM 
and  testing  your  board.  All  these  projects  require  at  least 
16K  RAM. 


The  EPROM  (2716)  Programmer 

Now  we  are  going  to  build  an  EPROM  (erasable  pro¬ 
grammable  read  only  memory)  programmer  and  an 
EPROM  read  board.  The  programmer  will  program  only 
the  2716  or  TMS2516  EPROMs  and  it  only  programs. 
You  cannot  verify  with  this  board;  I  omitted  verify  cir¬ 
cuitry  in  the  interests  of  simplicity  and  cost.  An  EPROM 
programmer  is  not  a  circuit  you  use  every  day.  While  the 
ability  to  verify  is  a  nice  convenience,  it’s  not  really 
necessary. 

Before  you  can  use  the  EPROM  read  board  or  the 
EPROM  programmer,  you  must  fully  decode  the  ROM  to 


keep  it  from  conflicting  with  this  new  address  space.  Use 
the  circuit  in  schematic  6  on  one  of  the  spare  IC  sockets 
on  the  expansion  board. 

If  you  make  the  0-6K  reader  you  will  no  longer  need 
this  circuit.  You  should  remove  it  to  keep  it  from  fighting 
the  decoders  on  that  board. 

After  you  program  an  EPROM,  turn  off  the  computer. 
Remove  the  programmer  board  and  take  the  programmed 
EPROM  from  it.  Install  the  EPROM  in  the  EPROM  read 
board.  Then  load  your  program  back  into  the  computer 
and  write  a  small  BASIC  program  to  verify  the  EPROM. 

When  you  have  the  printer  driver  on  EPROM  with  the 
original  program  in  RAM  starting  at  location  28672,  the 
verification  program  (listing  5)  goes  something  like  this: 


Listing  5 

10  LET  X=81 92 
20  FOR  N=28672  TO  28960 
30  IF  PEEK  XOPEEK  N  THEN  PRIN 
T  X 

40  LET  X=X+1 
50  NEXT  N 


Schematic  6.  All 
Trace  Numbers 
Refer  to  Expansion 
Board  Trace  Num¬ 
bers  as  Already 
Explained. 


A15  TRACE  37B 
A14  TRACE  38B 
A13  TRACE  39B 


GND 


38 


SYNTAX  QUARTERLY/SPRING  1983 


Our  EPROM  programming  program  (listing  6)  goes  like 
this: 


Listing  6 

10 

SLOW 

20 

LET  X 

=  8192 

30 

FOR  N 

=  28672 

TO  28960 

40 

POKE 

X,  PEEK 

N 

50 

LET  X 

=  X  +  1 

60 

PAUSE 

4 

70 

NEXT 

N 

With  my  programmer,  I’ve  never  had  a  “Not  Verify1 
that  was  the  hardware’s  fault.  The  only  one  I  programmed 
wrong  was  my  own  error.  If  you  see  dark  wide  horizontal 
bars  on  the  screen  during  programming,  the  EPROM  is  in 
backwards. 

The  programmer  has  its  own  one-shot  aboard  to  time 
the  programming  pulse,  so  you  need  no  software  for  this. 
But  be  careful  not  to  address  this  block  of  memory  again 
for  at  least  50  ms.  Hence  the  PAUSE  4  in  line  60.  Don’t 
leave  this  line  out! 

To  build  the  programmer,  etch  and  plate  the  board  just 
like  the  port  board  you  already  built.  Use  board  layout  3. 
On  this  board  you  need  to  jumper  from  pin  10  of  U5  to 
ground  on  the  bottom.  When  installing  the  feedthroughs, 
be  careful  not  to  put  any  where  C6,  C5,  Cl  and  R1 
mount  (just  to  the  left  of  U3) .  They  are  soldered  top  and 
bottom,  so  their  leads  act  like  the  feedthrough  (see 
schematic  7). 

Solder  a  solid  red  wire  to  the  bottom  of  the  board  to 
pad  marked  Vpp.  Solder  a  solid  black  wire  to  pad  12  of 


the  2716  (ground).  These  wires  should  extend  about  2 
inches  above  the  top  of  the  board.  Strip  the  ends  and 
bend  them  into  an  O  shape.  You  will  connect  the  25  volt 
supply  to  these  when  you  program. 

The  25  Vdc  regulated  power  supply  necessary  to  pro¬ 
gram  should  have  a  tolerance  of  +  or  - 1  volt.  You  may 
use  any  well  filtered  and  regulated  supply  you  like,  or  you 
can  construct  the  circuit  in  schematic  8  on  a  small  perfo¬ 
rated  board.  It  draws  very  little  current,  so  use  the 
smallest  and  cheapest  transformer  you  can  find. 

Turn  on  the  supply  just  before  you  run  the  BASIC  pro¬ 
gram,  and  turn  it  off  as  soon  as  programming  is  complete. 
It  should  be  off  while  you  enter  the  driver  program  and 
while  you  turn  the  computer  on  and  off.  Without  this 
voltage  present,  no  programming  can  take  place.  Use 
alligator  clips  on  the  output  wires  from  your  supply  to 
connect  it  to  the  solid  wires  on  the  board.  Be  careful  to 
keep  them  from  touching  any  other  boards  or  parts.  Also 
be  careful  not  to  attach  them  backwards!  Use  a  red  alli¬ 
gator  clip  for  -1-25  and  a  black  one  for  ground. 

Don’t  forget  to  install  C2  and  C3  on  the  bottom  of  the 
board.  All  vertical  ICs  have  pin  1  down,  while  horizontally 
mounted  ICs  (U4  and  U5)  have  pin  1  to  the  left  (viewing 
from  component  side  of  board).  Because  you  probably 
won’t  program  EPROMs  for  a  living,  a  ZIF  (zero  insertion 
force)  socket  for  the  EPROM  is  not  necessary.  Be  sure  to 
use  only  quality  parts  for  R1  and  Cl.  I  used  a  “mono¬ 
lithic”  capacitor  for  Cl  (5%).  Use  a  resistor  measured  to 
be  very  close  to  450K. 

EPROM  Read  Boards 

After  you  have  the  printer  converter/driver  routine  in 
EPROM,  you  need  to  make  the  8-16K  EPROM  read 


SYNTAX  QUARTERLY/SPRING  1983 


39 


board.  Use  the  same  method  we  used  for  all  the  other 
boards  in  these  projects,  using  board  layout  4.  The  socket 
on  the  bottom  is  mapped  8192-10239.  Second  from  the 
bottom  is  mapped  10240-12287.  Third  from  the  bottom 
is  12288-14335.  The  top  one  is  mapped  14336-16383. 

After  you  build  the  8-16K  read  board,  you  can  burn 
the  printer  driver  into  ROM  (listings  9  and  10) .  Then  after 
you  build  the  0-6K  board,  you  can  use  LFRINT,  LLIST 
and  COPY  to  your  printer  port! 

Don’t  forget  to  install  the  wire  jumper  from  pin  1  U1  to 
pin  6  U2.  The  tantalum  bypass  capacitor,  C3,  should  be 
mounted  underneath  the  bottom  EPROM  socket.  This  is 
because  Vcc  and  ground  come  into  the  memory  array 
from  the  top  and  are,  of  necessity,  small.  The  exact  value 
is  not  critical  because  it  is  only  really  used  as  a  “storage 
tank.”  Again,  Vcc  and  ground  should  be  built  up  with 
solder  for  low  impedance.  Cl  is  mounted  just  above  Ul; 
C2  is  mounted  just  left  of  E4.  Be  sure  to  observe  polarity 


on  these  components  (see  schematic  9) .  If  installed  back¬ 
wards,  they  will  sometimes  blow  up  like  a  firecracker! 

Our  final  project  is  to  construct  the  0-6K  EPROM  read 
board.  On  it  you  will  mount  one  to  three  EPROMs  con¬ 
taining  the  monitor  with  a  few  changes.  Construct  the 
0-6K  board  just  like  you  are  building  another  8-16K 
board,  except  make  the  changes  listed  on  the  schematic. 
You  will  not  use  the  top  socket  on  this  board  (see  sche¬ 
matic  10). 

We  want  at  least  part  of  the  monitor  on  EPROM  so  we 
can  change  things.  The  main  changes  we  want  are  in  the 
second  2K  block  (E2 — 2048-4095),  specifically,  a  call  to 
02E7  at  0876H.  After  this  patch,  we  can  use  all  Sinclair’s 
printer  commands,  LLIST,  LPRINT,  and  COPY.  At  this 
point  in  the  ROM,  the  HL  register  points  at  the  first  char¬ 
acter  to  print  and  the  D  register  contains  the  number  of 
lines  to  print  (1  if  printing  from  the  printer  buffer  or  22  if 
printing  from  the  display) .  We  want  to  change  this  call  to 


40 


SYNTAX  QUARTERLY/SPRING  1983 


MAPPED  FROM  8192  TO  10,239  DECIMAL 
2000  TO  27FF  HEX 


Ins .  TMS-2516  or 
Non-Texas  Ins.  2716 
EPROM  Program¬ 
mer 


SYNTAX  QUARTERLY/SPRING  1983 


41 


02E7  to  a  call  to  20C8.  With  the  call  to  20C8,  the  com¬ 
puter  goes  to  our  ASCII  convert/ drive  routine  instead  of 
entering  the  temporary  FAST  mode  as  originally  in¬ 
tended.  Here  we  save  on  the  stack  the  registers  we  will 
use,  convert  the  characters  to  ASCII  and  send  them  to 
the  printer,  get  the  registers  back  that  we  saved,  and  then 
simply  jump  to  02E7  for  the  monitor.  If  the  ZX  printer  is 
attached,  it  will  print  the  same  thing  our  printer  just  did.  If 
our  printer’s  own  print  switch  is  off,  the  computer  just 
prints  to  the  ZX  printer. 

To  change  0877  from  E7  to  C8  and  0878  from  02  to 
20,  copy  this  part  of  the  ROM  to  EPROM  with  the  BASIC 
program  in  listing  7  and,  of  course,  our  EPROM 
programmer. 

The  next  program,  listing  8,  copies  the  first  block  of  the 
monitor.  In  it,  we  change  location  4  from  FFH  to  FEH 
and  location  5  from  7FH  to  FFH.  With  this  change,  the 
monitor  checks  all  our  memory  on  power  up,  rather  than 
just  16K.  Now  if  you  have  greater  than  16K  on  your  com¬ 
puter,  you  won’t  have  to  move  RAMTOP  every  time  you 
power  up. 

You  change  location  3  to  only  254  because  the  monitor 
increments  the  initial  value  and  stores  it  as  RAMTOP. 
Thus  it  would  increment  255  to  0  and  store  0  as  RAM- 
TOP.  The  system  would  still  function,  but  the  display  file 


Listing  7. 

1 0 

SLOW 

20 

LET  X=81 92 

30 

FOR  N=2048  TO 

2166 

40 

POKE  X , PEE  K  N 

4 .  t 

50 

LET  X=X+1 

* 

60 

PAUSE  4 

70 

NEXT  N 

80 

PAUSE  4 

90 

LET  X=X+2 

100 

FOR  N=21 69  TO 

4095 

1 1  0 

POKE  X  ,  P  E  E  K  N 

120 

LET  X=X+1 

130 

PAUSE  4 

140 

NEXT  N 

150 

POKE  8311,200 

160 

PAUSE  5 

170 

POKE  8312,32 

42 


SYNTAX  QUARTERLY/SPRING  1983 


Listing  8. 


1 0 

POKE  8192, 

PEEK 

20 

PAUSE  5 

30 

POKE  8193, 

PEEK 

40 

PAUSE  5 

50 

POKE  8194, 

PEEK 

60 

PAUSE  5 

70 

POKE  8195, 

254 

80 

PAUSE  5 

90 

POKE  8196, 

255 

100 

PAUSE  5 

1 1  0 

LET  X=81 97 

120 

FOR  N=5  TO 

2047 

130 

POKE  X , P E E 

K  N 

140 

LET  X=X+1 

150 

PAUSE  4 

160 

NEXT  N 

would  be  collapsed.  Then  the  more  memory  your  pro¬ 
gram  used,  the  longer  the  computer  would  take  to  print 
something  on  the  screen.  I  know,  because  I  changed 
location  3  to  255  the  first  time! 

You  can  program  the  third  block  without  any  changes. 
However,  now  that  it  is  on  EPROM,  you  could  change  it 
if  the  need  arose.  The  last  block  can  be  programmed 
directly  also  if  you  want  to  put  it  on  EPROM.  If  you  do, 
you  have  to  mount  it  inside  the  computer  and  slightly 
rewire  the  socket  (see  below).  Because  the  character 
generator  is  in  this  last  block  of  memory,  you  may  want  to 
put  it  on  EPROM  to  change  the  characters.  I  changed  the 
British  pound  sign  to  a  “!”  because  I  didn’t  use  the  pound 
sign  enough  to  justify  its  own  key. 

If  you  choose  to  only  put  the  second  block  on  EPROM, 
then  you  must  also  build  the  little  circuit  to  decode  for  this 
(see  schematic  1 1) . 


ASCII  Convert  and  Copy  Routine 

Multilength  Character  Lines.  (POKE  system  flag  16507 
the  number  of  ‘ENTERs’  to  ignore.  16508  is  used  as  a 
counter.)  (Listing  9.) 


ASCII  Conversion  Table 


2000 

20 

81 

82 

83 

94 

95 

96 

97 

2008 

FF 

FC 

83 

22 

21 

24 

3A 

3F 

2010 

28 

29 

3E 

3C 

3D 

2B 

2D 

2A 

2018 

2F 

3B 

2C 

2E 

30 

31 

32 

33 

2020 

34 

35 

36 

37 

38 

39 

41 

42 

2028 

43 

44 

45 

46 

47 

48 

49 

4A 

2030 

4B 

4C 

4D 

4E 

4F 

50 

51 

52 

2038 

53 

54 

55 

56 

57 

58 

.59 

5A 

2040 

20 

20 

20 

20 

20 

20 

20 

20 

2048 

20 

20 

20 

20 

20 

20 

20 

20 

2050 

20 

20 

20 

20 

20 

20 

20 

20 

2058 

20 

20 

20 

20 

20 

20 

20 

20 

2060 

20 

20 

20 

20 

20 

20 

20 

20 

2068 

20 

20 

20 

20 

20 

20 

20 

20 

2070 

20 

20 

20 

20 

20 

20 

0D 

20 

2078 

20 

20 

20 

20 

20 

20 

20 

20 

2080 

FF 

FE 

FD 

FC 

EB 

EA 

E9 

E8 

2088 

FF 

83 

FC 

40 

23 

24 

7E 

25 

2090 

7B 

7D 

3E 

3C 

26 

2B 

5F 

2A 

2098 

2F 

60 

27 

2E 

30 

31 

32 

33 

20A0 

34 

35 

36 

37 

38 

39 

61 

62 

20A8 

63 

64 

65 

66 

67 

68 

69 

6A 

20B0 

6B 

6C 

6D 

6E 

6F 

70 

71 

72 

20B8 

73 

74 

75 

76 

77 

78 

79 

7A 

If  you  wish  to  put  the  last  block  (6-8K)  on  EPROM,  cut 
the  foil  trace  from  pin  18  of  the  ROM  socket  and  jumper 
pin  18  to  ground  (pin  12) .  Then  cut  the  trace  to  pin  21  on 
the  ROM  socket  and  jumper  pin  21  to  Vcc  (pin  24).  The 
6-8K  EPROM  must  be  in  the  main  computer  because  it 
contains  the  character  generator.  Install  the  programmed 
2716  into  the  ROM  socket  exactly  as  the  original  ROM 
was  installed.  SQ 


SYNTAX  QUARTERLY/SPRING  1983 


43 


Listing  10 

Address 

Location 

Contents 

20C0 

1616 

20C2 

2A0C40 

20C5 

23 

20C6 

1811 

Calls  here  (20C8)  from  monitor 

20C8 

3AFFFF 

20CB 

CB5F 

20CD 

2807 

20CF 

E5 

20D0 

D5 

20D1 

CDD920 

20D4 

D1 

20D5 

El 

20D6 

C3E702 

20D9 

7E 

20DA 

23 

20DB 

E5 

20DC 

210020 

20DF 

85 

20E0 

6F 

20E1 

3001 

20E3 

24 

20E4 

CD460F 

20E7 

3808 

20E9 

3E0D 

20EB 

32FFFF 

20EE 

El 

20EF 

CF 

20F0 

oc 

Label 

Mnemonic 

COPY 

LD  D,16 

LD  HL,(DFILE) 

INC  HL 

JR  CONV 

PTCH 

LD  A,  (PORT) 
BIT  3, A 

JR  Z  RETP 
PUSH  HL 
PUSH  DE 

CALL  CONV 

POP  DE 

POP  HL 

RETP 

JP  TFAS 

CONV 

LD  A,(HL) 

INC  HL 

PUSH  HL 

LD  HL.TABL 

ADD  L 

LD  L,A 

JR  NC  BRK? 

INC  H 

BRK? 

CALL  0F46 

JR  C  CHEK 

LD  A,0D 

LD  (PORT), A 

POP  HL 

RST  08H 
REPORT  D 

Comment 

;Set  ‘D’  for  22  lines 

;Get  screen  memory  address 

;  Point  at  first 

character 

;Go  and  copy  the 

;  screen 


;Get  printer  status 
;Is  print  switch  on? 

;  Return  to  monitor 
;  if  not  save  registers 
;used  for  ZX  printer 
;use,  later 

;Call  ASCII  Conv/Drive 
;  Routine 

;  Restore  registers 
;for  ZX  printer  use 

;Jump  to  Temp  Fast’ 
;for  monitor 

;Get  character  code  to 

;LPRINT 

;  Point  at  next 

character 

;Save  location  for 

;  later 

;  table 

;Point  at  conversion 
;  table 

;Add  displacement  code 
;Put  this  in  “lo”  byte 
;Jump  over  inc  if  no 
;  carry 

;  Increment  “hi”  byte 

;  Check  for  depressed 
;  break  key 
;  Jump  over  return  if 
;no  break 

;Put  ASCII  code  for 
;  carriage  return  in  A 
;And  send  it  to  the 
;  printer 

;  Clear  next  address 
;from  stack 
;  Return  w/report  UD” 

;  Break  key  pressed 


44 


SYNTAX  QUARTERLY/SPRING  1983 


Listing  10  Continued 


Address 

Location 

Contents 

Label 

20F1 

1E02 

CHEK 

20F3 

3AFFFF 

RDY? 

20F6 

FE18 

20F8 

20EA 

20FA 

ID 

20FB 

20F6 

20FD 

7E 

GUT 

20FE 

FEOD 

2100 

2012 

2102 

217B40 

LDN? 

2105 

F5 

2106 

7E 

2107 

23 

2108 

BE 

2109 

2805 

210B 

FI 

210C 

34 

210D 

15 

210E 

1807 

2110 

FI 

CCNT 

2111 

3600 

2113 

15 

2114 

32FFFF 

SEND 

2117 

El 

2118 

20BF 

211A 

C9 

Mnemonic 

Comment 

LD  E,02 

;Set  ‘E’  to  check 
;  status  twice 

LD  A,  (PORT) 

;Get  printer  status 

CP  18 

;Is  it  ready  to 
;  receive? 

JR  NZ  BRK? 

;Loop  to  break  test  if 
;not 

DEC  E 

;  Decrement  check 

;  counter 

;o.k. 

JR  NZ  RDY? 

;Loop  ‘till  2  times 

LD  A,(HL) 

;Get  converted  code  to 
;send 

CP  0D 

;Is  it  an  “ENTER”? 

JR  NZ  SEND 

;Go  and  send  it  if  not 

LD  HL,FLAG 

;  Point  at  multiline 
;flag 

PUSH  AF 

;Save  “ENTER”  on  the 
;  stack 

LD  A,(HL) 

;Now,  get  the  flag 

INC  HL 

;  Point  at  the  counter 

CP  (HL) 

;  Ready  to  send  “ENTER 
;now? 

JR  Z  CONT 

;  Clear  counter  &  send 
;  enter  if  true 

POP  AF 

;  Clear  the  stack 

INC  (HL) 

;  Increment  counter 

DEC  D 

;  Decrement  line 
;  counter 

JR  2117 

;Jump  over  driver, 

;  this  time 

POP  AF 

t 

;Get  “ENTER”  to  send 

LD  (HL),00 

;  Reset  the  counter 

DEC  D 

;  Decrement  the  line 
;  counter 

LD  (PORT), A 

;Send  character  to  the 
;  printer 

POP  HL 

;Get  next  char  address 
;to  convert 

JR  NZ  CONV 

;Go  do  next  char  if  not 
;done 

RET 

;  Return  to  caller 

SYNTAX  QUARTERLY/SPRING  1983 


45 


Operation  Codes 
of  the  8080,  8085, 
and  Z80  Processors 

D  Martin  Harrell 
313  Hollyberry  Rd 
Se verna  Park  MD  21146 


Manual  conversion  between  assem¬ 
bly  language  mnemonics  and  hexa¬ 
decimal  object  code  can  be  tedious  — 
particularly  if  much  code  is  involved. 
However,  the  task  does  not  have  to 
be  overwhelming.  A  conversion  table 
helps  immensely  and  is  also  a  good 
training  aid  for  novice  programmers. 
It  presents  the  entire  instruction  set  in 
compact  form,  revealing  useful  pat¬ 
terns,  and  also  inconsistencies. 

8080  and  8085  Operation  Codes 

Operation  codes  for  the  Intel  8080 
and  8085  microprocessors  are  shown 
in  table  1.  The  only  difference  be¬ 
tween  the  instruction  sets  for  this  pair 
is  that  the  8085  has  two  additional  in¬ 
structions:  the  read-interrupt-mask 
instruction  (mnemonic  RIM,  hexa¬ 
decimal  code  20),  and  the  set-inter¬ 
rupt-mask  instruction  (mnemonic 
SIM,  hexadecimal  code  30).  They 
allow  the  user  to  control  interrupts 
and  a  serial  I/O  (input/  output)  line, 
thus  making  them  useful  additions. 

The  position  of  an  8080/8085  oper¬ 
ation  code  in  the  table  does  not  give  a 
reliable  clue  about  the  implied  ad¬ 
dressing  mode.  Table  1  is  generally 
organized  according  to  the  operands 
involved.  Residing  in  the  middle  eight 
columns  of  the  table  (columns  4  thru 
B)  for  example,  are  the  instructions 
for  single-byte  move,  arithmetic,  and 
logical  operations.  (Length  attributes 
in  this  article  refer  to  data,  rather 
than  instruction  length,  unless  other¬ 


wise  noted.)  Regardless  of  the 
column,  progression  through  the 
eight  possible  choices  for  the  source 
(second)  operand  is  always  in  the 
same  sequence  as  the  user  moves 
down  a  column:  registers  B  thru  L; 
followed  by  memory  reference;  and 
finally,  register  A,  the  accumulator. 
Then,  because  each  column  has  six¬ 
teen  entries,  the  sequence  repeats.  If 
the  arithmetic  and  logical  instruction 
groups  do  not  seem  to  conform  to  this 
rule,  note  that  the  first  operand 
(always  register  A)  is  implied  rather 
than  stated  explicitly. 

This  same  sequence  is  used  for  ad¬ 
vancing  through  choices  for  the 
destination  (first)  operand.  In  this 
case,  however,  progression  is  column 
to  column  from  left  to  right,  with 
each  successive  column  containing 
two  of  the  eight  possible  operands. 
The  double-byte  instructions  also 
conform  to  this  first-operand  type  of 
arrangement.  Most  of  these  appear  in 
the  first  four  columns  of  the  table; 
however,  the  stack  commands  to 
PUSH  and  POP  double-byte  data  are 
located  at  the  far  right  in  the  top 
section. 

An  apparent  inconsistency  appears 
in  the  middle  of  the  table.  Hexa¬ 
decimal  code  76  is  the  instruction  to 
halt  the  processor  (HLT).  Expected 
there  instead  is  MOV  M,M,  the  op 
code  meaning  "move  the  content  of 
the  memory  location  whose  address  is 
in  the  H  and  L  register  pair  into  that 


same  memory  location/'  The  expect¬ 
ed  instruction  is  effectively  just  a  slow 
equivalent  of  the  no  operation  (NOP) 
located  at  hexadecimal  00.  Hence,  its 
replacement  by  the  halt  command 
improves,  rather  than  degrades  the 
power  of  the  instruction  set.  Still,  I 
wonder  why  an  otherwise  empty  spot 
in  the  table  was  not  chosen  —  as  was 
done  for  the  two  additional  8085 
instructions. 

The  right  quarter  of  the  table  main¬ 
ly  contains  program  branching  and 
data  exchange  instructions.  Excluding 
the  previously  mentioned  stack  com¬ 
mands,  none  of  these  have  explicit 
operands  so  the  previously  discussed 
organization  is  impossible.  The  mis¬ 
cellaneous  nature  of  these  instruc¬ 
tions  also  tends  to  prevent  predictable 
order. 

Nonetheless,  the  op  codes  in  this 
area  have  a  consistent  structural 
style.  Most  are  arranged  in  com¬ 
plementary  order,  with  mutually 
exclusive  conditions  placed  in  the 
same  column,  separated  by  eight 
rows.  The  group  of  return  instruc¬ 
tions  is  typical.  The  unconditional 
return  from  subroutine  command  is 
hexadecimal  C9.  Starting  immediate¬ 
ly  above  it  and  proceeding  to  the 
right,  four  of  the  eight  conditional 
return  instructions  are  found.  The 
other  four  (the  complements)  are 
eight  rows  higher. 

The  order  in  which  these  condi¬ 
tions  appear  is  uniform  from  group  to 
group.  To  determine  that  this  is  so, 
compare  similar  elements  of  the  call, 
jump,  and  return  groups.  The  uncon¬ 
ditional  jump  (JMP)  instruction  is  a 
curious  exception.  Its  expected  code  is 
CB,  but  it  actually  appears  eight  rows 
higher  in  the  table.  Such  exceptions 
are  few  enough  not  to  be  bothersome. 

Z80  Operation  Codes 

The  Z80  is  an  enhanced  version  of 
the  8080.  It  runs  faster,  has  twice  as 
many  general  purpose  registers,  and 
has  a  much  larger  instruction  set. 
Included  as  a  subset  in  this  instruction 
is  the  entire  repertoire  of  the  8080. 
(This  compatibility  exists  at  the 


“From  Operation  Codes  for  8080,  8085,  and  Z80  Processors  by  D.  Martin  Harrell 
appearing  in  March  1980  issue  of  BYTE  magazine.  Copyright  ©1980  Byte  Publica¬ 
tions,  Inc.  Used  with  the  permission  of  Byte  Publications,  Inc.” 


46 


SYNTAX  QUARTERLY/SPRING  1983 


machine  language  level,  but  not  the 
assembly  language  level;  standard 
mnemonics  and  assembly  language 
formats  tor  the  two  processors  differ 
considerably.)  Thus,  in  hexadecimal 
object  form,  almost  any  program 
written  for  the  8080  will  produce 
identical  results  when  executed  by  a 
Z80.  Because  of  the  Z80's  generally 
higher  speed,  software  timing  loops 
are  an  exception  to  this  upward  com¬ 
patibility  feature.  [Editor's  note: 
There  is  also  a  slight  difference  in  the 
operation  of  the  parity  flag  .  .  .  .RSS] 

The  similarities  of  the  two  instruc¬ 
tion  sets  can  be  seen  by  comparing 
corresponding  positions  of  table  1 
and  table  2.  Table  2  is  the  basic  con¬ 
version  table  for  the  Z80.  For  every 
valid  8080  instruction  in  table  1,  its 
correspondent  in  table  2  produces 
logically  equivalent  results.  The  dif¬ 
ferences  between  the  two  instruction 
sets  stem  from  the  twelve  positions 
unused  by  the  8080.  These,  which  are 
clearly  indicated  in  table  2,  are  used 
to  greatly  expand  the  Z80's  capabil¬ 
ity. 

The  Zilog  Corp  used  the  seven  un¬ 
filled  positions  on  the  left  side  of  table 
1  and  the  uppermost  one  on  the  right 
side  to  give  the  Z80  processor  the 
ability  to  perform  relative  branching 
and  to  exchange  the  contents  of  its 
two  sets  of  registers.  However,  the 
use  of  hexadecimal  codes  20  and  30 
for  two  of  the  jump  relative  instruc¬ 
tions  means  that  the  Z80  is  not  as 
compatible  with  the  8085  as  it  is  with 
the  8080. 

The  real  expansion  of  the  Z80's  in¬ 
struction  set  over  that  of  the  8080  is 
the  result  of  the  interesting  use  of  the 
four  other  empty  spaces  in  table  1.  In 
essence,  the  Z80  uses  them  as  pointers 
to  four  additional  16  by  16  tables, 
thus  increasing  the  number  of  possi¬ 
ble  op  codes  by  1532.  (The  Z80  does 
not  use  most  of  these,  but  flexibility 
for  future  expansion  is  certainly 
there.)  Had  this  innovative  use  of  the 
unimplemented  codes  not  been  done, 
the  Z80  would  have  been  limited  to 
256  different  op  codes,  which  is  only 
twelve  more  than  the  8080. 

There  is  a  penalty  for  this  flexibi¬ 
lity:  all  instructions  in  these  expan¬ 
sion  sets  must  be  multibyte.  The  first 
byte  identifies  the  appropriate  expan¬ 
sion  instruction  set,  after  which,  the 


second  byte  identifies  the  operation 
to  be  performed.  Sometimes  there  is 
an  additional  third  or  fourth  byte  to 
provide  data  or  addressing  informa¬ 
tion. 

Shift,  Rotate,  and  Bit 
Manipulation  Instructions 

Consider  these  pointer  instructions 
one  at  a  time.  All  of  the  instructions 
which  begin  with  hexadecimal  CB  are 
contained  in  table  3.  All  of  the  direct¬ 
mode  instructions  to  shift  or  rotate 
(in  either  direction)  any  byte  in 
memory  or  in  any  of  the  eight  active 
registers  are  located  here.  Table  3  also 
contains  the  direct-mode  instructions 
to  set,  reset,  or  test  any  bit  in  any  of 
these  bytes.  All  of  these  operations 
have  a  length  of  two  bytes.  Interest¬ 
ingly,  there  are  more  valid  instruction 
combinations  derived  from  the  ten 
basic  instructions  in  this  table  than 
there  are  in  the  entire  8080  set. 

Two  features  of  table  3  are  notable. 
The  first  is  the  absence  of  a  'shift  left 
logical"  counterpart  to  the  SRL  com¬ 
mand  group.  The  shift  left  logical 
counterpart  is  not  there  because  it  is 
not  needed;  the  "arithmetic  shift  left" 
instructions  in  column  2  (hexa¬ 
decimal)  accomplish  this  function. 
The  use  of  the  same  general  organi¬ 
zational  rules  indicated  earlier  for  the 
8080  is  the  more  important  of  the 
two  properties  of  this  table.  Such 
uniformity  is  a  good  aid  in  locating 
instructions  in  this  table. 

Indexed  Instructions 

Instructions  beginning  with  hexa¬ 
decimal  DD  are  in  one  of  two  indexed 
classes  of  instructions.  These  use  the 
IX  and  IY  registers  respectively  in 
forming  a  data  address.  Those  related 
to  the  former  are  depicted  in  table  4 
and  its  associated  table  5. 

The  analogy  between  tables  2  and  4 
and  between  tables  3  and  5  is  striking. 
The  organizational  patterns  are  iden¬ 
tical  —  even  to  the  point  of  using  the 
same  expansion  technique.  They 
should  be  identical.  Each  of  these 
indexed  instructions  was  formed  by 
replacing  the  (HL)  operand  of  an 
equivalent  register-indirect  instruc¬ 
tion  with  the  indexed  notation 
(IX  +  d).  Thus,  every  operation  that 
can  be  performed  in  the  register- 
indirect  mode  by  the  8080  or  Z80  can 


also  be  performed  in  the  indexed 
mode  by  the  Z80. 

The  resulting  positional  equiva¬ 
lence  between  the  two  sets  of  tables  is 
most  helpful  in  determining  the 
required  hexadecimal  code  for  the 
indexed  instructions.  An  easy  way  to 
do  this  without  having  to  refer  to 
tables  4  or  5  is  to  first  select  from 
table  2  or  3  (as  appropriate)  the  hexa¬ 
decimal  code  for  the  register-indirect 
form  of  the  desired  operation.  Then 
place  a  DD  prefix  in  front  of  this  code 
if  the  operation  was  found  in  table  2, 
or  a  DDCB  prefix,  if  found  in  table  3. 
Finally,  place  after  this  code  group  a 
displacement  suffix,  d. 

The  Z80  also  has  a  second  index 
register,  which  is  designated  the  IY 
register.  Op  codes  which  use  it  for 
addressing  are  contained  in  tables  6 
and  7.  It  takes  only  a  quick  glance  to 
notice  the  strong  similarity  between 
tables  4  and  6  and  between  tables  5 
and  7.  As  might  be  expected,  virtual¬ 
ly  everything  said  previously  about 
the  IX  class  of  op  codes  also  refers  to 
the  IY  class.  The  sole  exception  to  this 
statement  is  that  the  IY-type  instruc¬ 
tions  begin  with  hexadecimal  code 
FD,  instead  of  DD. 

Miscellaneous  Additions 

All  fifty-six  instructions  in  the  last 
of  the  four  expansion  sets  begin  with 
hexadecimal  code  ED.  They  are  listed 
in  table  8.  Though  they  are  quite 
heterogeneous,  they  add  considerably 
to  the  power  of  the  Z80.  Among 
these,  for  example,  are  instructions 
that  enhance  the  16 -bit  arithmetic 
capability,  set  interrupt  modes,  per¬ 
mit  complementing  the  accumulator, 
and  allow  a  register-indirect  type  of 
I/O  to  be  performed.  There  are 
instructions  also,  which  allow  coun¬ 
ting  or  block  processing  to  be  done 
during  loading,  comparison,  and  I/O 
operations.  Even  if  the  other  three 
expansion  sets  were  omitted,  the 
instructions  in  this  set  would  be 
highly  useful  additions  to  the  basic 
8080  complement. 

With  such  a  hodgepodge  of  func¬ 
tion,  it  is  rather  surprising  that  any 
order  at  all  can  be  made  of  these  ED 
class  instructions.  Nonetheless,  con¬ 
sistency  with  the  other  tables  is  main¬ 
tained.  It  is  evident  from  the  arith¬ 
metic  and  the  leftmost  I/O  instruc- 


SYNTAX  QUARTERLY/SPRING  1983 


47 


tions  that  arrangement  by  order  of 
tirst  and  second  operands  is  used 
whenever  possible.  Separation  of 
complementary  functions  by  eight 
rows  in  a  column  is  also  followed. 

There  are  696  valid  op  codes  in  the 


seven  Z 80  tables.  Without  organiza¬ 
tional  consistency,  conversion  of 
these  instructions  from  mnemonic  to 
hexadecimal  form  would  be  extreme¬ 
ly  difficult  and  probably  ridden  with 
error.  Fortunately,  these  codes  are 


very  well  arranged,  following  the  pat¬ 
tern  established  for  the  8080.  It  takes 
a  little  practice  to  become  adept  at 
making  these  transformations,  but 
with  the  aid  of  these  tables  it  can  be 
accomplished  successfully.  ■ 


i&mf  lit  mum  IP  '■  wm 

•«{ tHi! 


thfuithmft  till  no 

ijiftittmftm-ttrjit 


rf[V "fi* 


48 


SYNTAX  QUARTERLY/SPRING  1983 


First  Nybble 


fc 

RP 

POP  PSW 

jp 

DI 

CP 

HJSH  PSW 

0RI 

3 

H 

V 

£ 

SPHL 

a 

— 

u 

CM 

— 

CPI 

— 

Eh 

X 

JPO 

X 

a 

— 

H 

H 

RK 

£ 

i 

CP0 

£ 

£ 

ANI 

Eh 

& 

w 

a 

i 

JPE 

s 

X 

CPE 

XRI 

Eh 

e 

X 

RNC 

POP  D 

JNC 

_ 

Eh 

B 

o 

5 

PUSH  D 

ins 

RST  16 

a 

or 

a 

CC 

SBI 

Eh 

a 

POP  B 

pq 

1 

1 

1 

u 

RNZ 

JNZ 

JMP 

CNZ 

X 

CO 

£ 

ADI 

RST  0 

RZ 

RET 

JZ 

cz 

CALL 

ACI 

RST  8 

X 

o 

X 

td 

X 

-i 

£ 

X 

X 

o 

pq 

w 

X 

X 

£ 

X 

X 

P§ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

g 

X 

ft 

ft 

% 

ft 

ft 

ft 

o 

o 

o 

o 

o 

o 

o 

o 

u 

s 

§ 

u 

S 

0 

0 

0 

X 

o 

x 

w 

X 

£ 

X 

X 

o 

pq 

Cd 

X 

X 

£ 

X 

X 

< 

X 

x 

X 

< 

< 

< 

X 

% 

3 

a 

a 

a 

a 

a 

* 

3 

§ 

pq 

o 

X 

w 

X 

£ 

X 

X 

o 

pq 

w 

X 

X 

£ 

X 

Os 

pq 

pq 

pq 

pq 

PQ 

X 

X 

X 

X 

X 

X 

X 

X 

X 

X 

X 

X 

CO 

co 

X 

W 

CO 

Eo 

X 

X 

X 

X 

X 

X 

X 

X 

X 

pq 

u 

X 

w 

X 

£ 

X 

X 

o 

pq 

pq 

X 

X 

£ 

X 

00 

§ 

§ 

x 

§ 

§ 

§ 

§ 

Q 

pq 

a 

a 

a 

a 

a 

a 

a 

a 

x 

x 

X 

X 

X 

< 

X 

X 

X 

X 

X 

X 

X 

X 

X 

X 

pq 

o 

Q 

w 

X 

X 

X 

u 

pq 

pq 

X 

X 

£ 

X 

x 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

X 

X 

X 

X* 

X 

X 

X 

x" 

> 

> 

> 

> 

> 

> 

X 

> 

> 

> 

> 

> 

> 

> 

> 

> 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

pq 

O 

X 

Cd 

X 

X 

£ 

X 

X 

o 

pq 

pq 

X 

X 

£ 

X 

SO 

X~ 

X 

X 

X 

X 

X* 

X 

x" 

X 

£ . 

X 

X 

x" 

X 

X 

X 

> 

> 

> 

■> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

§ 

> 

X 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

CP 

O 

Q 

td 

X 

X 

£ 

X 

X 

O 

Q 

Cd 

X 

X 

£ 

X 

X 

X 

X* 

X 

Q 

a 

q" 

Q 

w“ 

w 

w" 

Cd"  | 

Cd" 

pq 

Cd" 

Cd" 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

> 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

pq 

O 

Q 

Pd 

X 

X 

£ 

X 

X 

O 

Q 

Cd 

X 

X 

£ 

X 

pq 

pq 

cq 

PQ" 

PQ* 

PQ 

x" 

PQ 

o 

o 

O 

O 

o 

u 

U 

U 

> 

> 

> 

>■ 

> 

> 

> 

> 

> 

> 

>' 

> 

> 

> 

> 

>• 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

£ 

X 

X 

X 

X 

CO 

CO 

£ 

£ 

£ 

X 

X 

X 

X 

X 

rq 

§ 

hH 

H 

X 

X 

X 

H 

pq 

a 

X 

X 

X 

£ 

trt 

a 

CO 

s 

5 

a 

£ 

X 

a 

X 

a 

5 

a 

> 

£ 

U 

11 

X 

X 

X 

X 

X 

X 

pq 

x 

X 

X 

X 

§ 

M 

X 

X 

X 

X 

5 

pq 

X 

X 

X 

X 

n 

a 

CO 

a 

5 

a 

£ 

a 

a 

X 

a 

5 

a 

> 

£ 

Q 

X 

Q 

Q 

Q 

pq 

pq 

Q 

X 

pq 

Cd 

Cd 

M 

a 

X 

X 

X 

M 

X 

cq 

2 

X 

X 

X 

!_) 

a 

a 

E- 

co 

5 

5 

a 

£ 

X 

a 

3 

a 

5 

a 

£ 

PQ 

X 

o 

a. 

o 

M 

a 

X 

X 

X 

tH 

X 

>j 

X 

X 

X 

o 

05 

£ 

a 

E- 

co 

5 

5 

a 

> 

£ 

a 

a 

5 

a 

> 

£ 

X 

O 

- 

CSJ 

f'N 

sO 

CS- 

00 

Os 

X 

X 

o 

pq 

Cd 

X 

apqq^N  puooeg 


I  55 

-c  c 
**  a 


£o 
C  5 
c  * 

P>  ^ 

c 
o 
u 

•§  § 

i  ^ 

k.  k. 

®  v5 


Cu 


o  * 

JO  2* 
<A  •f- 
PU  •*- 
U  ^ 

8  ° 
a. 


5  -2 

Lo  C 

00  o 
o  o 
00  — 

•*  g 

c  § 

a  -2 

29  .n 
§  c 
cs 

-c  00 

*-  o  .c 
'o'  ^  "5 

S-s  j 

-§  * 

O  -£>  >> 
<j  -q  -a 

S  ts 

o  7S  ^ 

’■§  «  « 
?  V)  <U 

s..*-! 

o  ^  -5 
°  « 


■£  .a  $ 
vrrS  10 

O  ^  00 
u)  .  O 

<J  0)  00 

|  o  S 
2  <j  •£ 
^  tJ  c 
c  .*> 

5!  -a 

<  o  c 

*  U  0 

V  £  "TS 

-3  2  C 
M  2  3 
■2  *»  o 

MS  v 


RET  P 

POP  AF 

JP  P,nn 

M 

Q 

CALL  P,nn 

PUSH  AF 

OR  n 

X 

a 

Eh 

a 

£ 

U 

X 

LD  SP.HL 

JP  M,nn 

M 

W 

CALL  M ,nn 

See  Table  6 

CP  n 

X 

Eh 

Cd 

RET  PO 

POP  HL 

JP  PO.nn 

EX  (SP),HL 

CALL  P0,nn 

PUSH  HL 

AND  n 

RST  20H 

RET  PE 

JP  (HL) 

JP  PE,nn 

s| 

td 

X 

S 

CALL  PE,nn 

See  Table  8 

XOR  n 

RST  28H 

X 

RET  NC 

POP  DE 

JP  NC ,nn 

OUT  (n),A 

CALL  NC ,nn 

PUSH  DE 

SUB  n 

RST  10H 

RET  C 

X 

X 

UJ 

JP  C ,nn 

IN  A, (n) 

CALL  C,nn 

See  Table  4 

SBC  A ,n 

RST  18H 

o 

RET  NZ 

POP  BC 

JP  NZ.nn 

JP  nn 

CALL  NZ ,nn 

PUSH  BC 

ADD  A ,n 

RST  00H 

RET  Z 

RET 

JP  Z  ,nn 

See  Table  3 

CALL  Z,nn 

CALL  nn 

ADC  A,n 

RST  08H 

X 

OR  B 

OR  C 

OR  D 

OR  E 

X 

X 

o 

OR  L 

OR  (HL) 

OR  A 

CP  B 

CP  C 

CP  D 

CP  E 

CP  H 

CP  L 

CP  (HL) 

CP  A 

X 

AND  B 

AND  C 

AND  D 

AND  E 

AND  H 

AND  L 

AND  (HL) 

AND  A 

XOR  B 

XOR  C 

XOR  D 

XOR  E 

XOR  H 

XOR  L 

XOR  (HL) 

XOR  A 

Os 

SUB  B 

SUB  C 

SUB  D 

SUB  E 

SUB  H 

SUB  L 

SUB  (HL) 

SUB  A 

SBC  A ,B 

SBC  A,C 

SBC  A,D 

SBC  A,E 

SBC  A,H 

SBC  A ,L 

SBC  A,  (HL) 

SBC  A, A 

00 

ADD  .4 ,  B 

ADD  A,C 

ADD  A,D 

ADD  A,E 

ADD  A,H 

ADD  A,L 

ADD  A , ( HL) 

ADD  A, A 

ADC  A,B 

ADC  A, C 

ADC  A,D 

ADC  A,E 

ADC  A.H 

ADC  A, L 

X 

X 

X 

§ 

ADC  A, A 

cs. 

LD  (HL),B 

LD  (HL),C 

X 

g 

9 

LD  (HL),E 

LD  (HL),H 

LD  (HL),L 

HALT 

LD  (HL) , A 

LD  A,B 

— 

LD  A,C 

X 

X* 

9 

LD  A,E 

X 

3 

LD  A, L 

LD  A, (HL) 

LD  A, A 

SO 

LD  H.B 

LD  H,C 

X 

X 

3 

Cd 

X 

3 

X 

X 

3 

LD  H,L 

LD  H,(HL) 

LD  H,A 

LD  L,B 

LD  L,C 

LD  L,D 

LD  L,E 

LD  L,H 

LD  L,L 

LD  L,(HL) 

X 

X 

3 

X 

pq" 

9 

o 

pq 

3 

x^ 

x“ 

3 

Cd 

pq 

3 

X 

pq 

9 

LD  D,L 

LD  D, (HL) 

X 

pq 

3 

X 

Cd" 

3 

o 

Pd* 

9 

x_ 

Cd' 

3 

Cd 

Pd" 

3 

— 

LD  E,H 

X 

Pd 

9 

g 

td" 

3 

LD  E,A 

LD  B,B 

o 

PQ 

3 

x_ 

PQ 

9 

LD  B,E 

LD  B,H 

X 

PQ 

3 

LD  B, (HL) 

LD  B, A 

X 

o 

3 

— 

LD  C,C 

X 

u 

9 

Pd 

o" 

9 

LD  C,H 

'  LD  C,L 

LD  C,(HL) 

LD  C ,  A 

rq 

<n 

o' 

Z 

CC 

LD  SP,nn 

LD  (nn) , A 

INC  SP 

g 

o 

0 

DEC  (HL) 

c 

g 

9 

SCF 

CD 

o 

QC 

ADD  HL,SP 

I 

X 

3 

DEC  SP 

INC  A 

X 

1 

c 

X* 

3 

CCF 

CSI 

JR  NZ,e 

LD  HL,nn 

LD  (nn) ,HL 

INC  HL 

INC  H 

DEC  H 

LD  H,n 

1 

CD 

ini' 

CC 

—» 

ADD  HL.HL 

LD  HL, (nn) 

DEC  HL 

INC  L 

DEC  L 

c 

X 

3 

CPL 

- 

DJNZe 

a 

9 

LD  (DE),A 

INC  DE 

INC  D 

DEC  D 

c 

pq 

3 

RLA 

JR  e 

ADD  HL.DE 

1 

X 

3 

DEC  DE 

INC  E 

DEC  E 

fi 

Pd" 

3 

RRA 

o 

NOP 

§ 

a 

3 

LD  (BC) , A 

INC  BC 

INC  B 

DEC  B 

LD  B,n 

RLCA 

u. 

< 

llT 

X 

LU 

ADD  HL,BC 

LD  A, (BC) 

DEC  BC 

INC  C 

DEC  C 

LD  C,n 

1 

o 

- 

CSi 

<r\ 

SO 

Cs. 

CO 

Os 

X 

X 

u 

X 

Pd 

Cd 

aiqq^N  puooag 


SYNTAX  QUARTERLY/SPRING  1983 


49 


Table  2:  Mnemonics  of  the  operation  codes  of  the  Z80  microprocessor  arranged  for  conversion  to  hexadecimal  object  code.  Corre¬ 
sponding  positions  of  table  1  and  table  2  generally  perform  the  identical  function,  despite  differences  in  notation.  Enhancements  of 
the  8080  instruction  set  are  indicated  by  shading.  Mnemonics  used  here  are  those  specified  by  Zilog. 


First  Nybble 


eiqq-^N  puooeg 


®iqq^N  puooag 


50 


SYNTAX  QUARTERLY/SPRING  1983 


Table  4:  Operations  of  the  Z80  invoked  by  the  instruction  prefix  DD.  These  provide  indexed-mode  instructions  equivalent  to  the 
indirect-mode  instructions  and  employ  the  IX  register. 


(ix+d)  RL  (ix+d)  SLA  (ix+d)  BIT  0,(lX+d)  BIT  2,(lX+d)  BIT  4,(lX+d)  BIT  6,(lX+d)  RES  0,(lX+d)  RES  2,(lX+d)  RES  4,(lX+d)  RES  6,(lX+d)  SET  0,(lX+d)  SET  2,(lX+d)  SET  4,(lX+d)  SET  6,(lX+d) 


B 


SYNTAX  QUARTERLY/SPRING 


Table  6:  Indexed  instructions  employing  the  IY  register.  Note  the  similarity  with  table  4.  These  operation  codes  begin  with  the  FD  prefix. 


CHANGE  YOUR 

TIMEX/SINCLAIR  1 OOO  DISPLAY 


"TO  FULL  COLOUR  GRAPHICS 

K  0  L  or w onus 


LOOK  AX  THE  FEATURES 


Plugs  into  ZX81/1000  (edge  connector) 

Latest  technology  with  TMS9918  VDP 
(32  sprite  levels) 

Module  contains  it's  own  memory 
All  text  will  run  on  the  color  tv 


I  i 

User  defined  characters  &  graphics  up  to 
256x192  pixels 

Module  contains  extension  of  basic 
commands  including:  PAPER/INK/ 
BORDE  R/BIN/SP  RITE/OUT/IN  P/etc 

-For-  95 


KOLORWORKS  COMES  WITH  A  LIMITED  WARRANTY  ON  PARTS  AND  WORKMANSHIP 

USE  YOUR  KOLORWORKS  IMMEDIA  TEL  Y  WITH  A  GAME  CASSETTE  FOR  $9.95 

This  delightful  game  is  designed  for  hours  of  fun  using  some  of  the  color  graphic  capabilities  of 
KOLORWORKS.  The  cassette  also  contains  a  short  program  to  familiarize  you  with  some  of  the 
commands  and  graphics. 


)□□□□□□□□□□□□□□□□□□□□□□□□ 


Enjoy  Game  Fun  With 


GAAMWORKS 

THE  SOON  TO  BE  RELEASED  GAME  MODULE 
(proto  type  stage)  WILL  OFFER  SOUND,  ROM 
CARTRIDGES  AND  JOY  STICK  PORTS  FOR 
YOUR  TS1000/ZX81. 

♦  THE  SOUND  will  be  of  arcade  game  quality 
which  you  can  program  for  music,  animals,  trans¬ 
portation  (auto,  train,  airplane,  etc.)  and  ma¬ 
chine  sounds. 

♦  ROM  CARTRIDGES  will  have  up  to  8K  of  ROM 
using  either  2716,  2732  or  2764  EPROMS.  We 
will  have  pre-programed  cartridges  and  blank 
cartridges  which  you  can  program.  We  will  be 
offering  a  service  to  burn  EPROMS  from  your 


cassettes. 

♦  JOY  STICK  PORTS  will  allow  for  the  use  of  two  "Atari''®compatible  joy  sticks. 

SORRY  PRICE  IS  NOT  AVAILABLE  AT  THIS  TIME!  GAAMWORKS  WILL  BE  AVAILABLE  BY  MAIL  ORDER 
STARTING  MARCH  1st.  FOR  FURTHER  INFORMATION ,  SEND  $2.00  (Credited  to  Order). 

_ At  this  time  KOLORWORKS  and  GAAMWORKS  is  available  only  by  mail  order. 


MAIL  TO:  BRAINCHILD  COMPUTER  WORKS,  INC. 

P.O.  Box  506 
Pewaukee,  Wl  53072 


PRICE  QTY.  AMOUNT 


KOLORWORKS 

$149.95 

CASSETTE 

9.95 

Shipping  &  Handling 

4.95 

4.95 

Wi.  residents  add  sales  tax  TAX 

TOTAL 

My  Qcheck  Q  money  order  is  enclosed  ENCLOSED 

Name 


Street 


City 


State 


Zip 


52 


Please  allow  six  to  eight  weeks  for  processing.  Thank  you. 


SYNTAX  QUARTERLY/SPRING  1983 


RES  4,(lY+d)  RES  6,(lY+d)  SET  0,(lY+d)  SET  2,  (IY+d)  I  SET  4,  (iY+d)  I  SET  6,(lY+d) 


SYNTAX 


Table  8:  The  class  of  miscellaneous  instructions  invoked  by  the  ED  prefix. 


SOFTWARE  REVIEW 


Sky-High  ZX/TS 

Name:  Flight  Simulation 
Type:  Game/Education 
ROM/RAM  reqd:  8K/16K 
Listable?  Yes 
Printed  listing?  No 
Screen  prompts?  Yes 
Easy  to  load?  Yes 
Display:  Excellent 
From:  Sinclair  Research  Ltd. 

3  Sinclair  Plaza 
Nashua,  NH  03061 
Price:  $9.95 


Psion’s  Flight  Simulation  comes  on 
tape  with  a  seven-page  instruction 
leaflet  that  fits  inside  the  cassette 
case.  The  detailed  instructions  pro¬ 
vide  a  good  introduction  to  flying 
novices.  After  a  short  time,  you’ll 
have  no  trouble  remembering  what 
keys  control  which  aircraft  functions. 
Instead,  you  can  concentrate  on  fly¬ 
ing  and  landing  safely. 

My  tape  consistently  loads  for  me 
every  time  1  use  it.  The  “flip”  side  is 
blank.  The  program  is  listable  and  in¬ 
cludes  a  good  bit  of  machine  code. 

Flight  Simulation  sets  up  two  situa¬ 
tions.  You  may  choose  just  the  final 
approach  or  “full  feature.”  The  final 
approach  situation  lines  you  up 
nicely  on  the  correct  vector  about 
five  miles  out,  800  feet  in  the  air.  Full 
feature  sets  you  randomly  within  25 
miles  of  the  airport.  You  must  pilot 
yourself  to  the  correct  vector  and 
altitude  for  your  final  approach.  It  is 
not  as  easy  as  it  sounds,  especially  if 
you  allow  the  wind  to  be  a  factor. 


You  get  three  different  screen 
displays — cockpit,  map  or  moving 
runway. 

On  the  cockpit  display,  you  see 
the  pilot’s  view  of  the  instruments 
and  a  silhouette  of  the  horizon  as 
seen  from  inside  the  aircraft.  Given 
the  ZX/TS  graphics,  it  is  a  very  effec¬ 
tive,  functional  display. 

For  a  map  of  the  entire  area 
around  the  airport,  use  the  map 
display.  The  map  extends  about  20 
to  25  miles  from  the  landing  field. 
Shown  on  the  map  are  the  landing 
field,  the  six  beacons  you  can  use  for 
guidance,  some  cliffs  east  of  the 
landing  strip,  and  your  heading.  A 
flashing  dot  on  the  map  represents 
your  current  position.  This  very  nice 
display  is  remarkably  detailed. 

Display  three  is  a  moving  display 
of  the  runway  as  you  approach  for 
landing.  Yes,  it  does  move.  It  also 
shows  your  speed  and  altitude.  This 


display  is  extremely  well  done  and 
impressive  to  see. 

You  may  crash  your  craft  in  a 
variety  of  ways,  with  a  nice  graphic 
explosion  and  subsequent  crash 
report  telling  you  what  happened. 
You  may  tear  off  your  wing  flaps, 
land  with  your  landing  gear  up, 
smack  into  the  escarpment  at  too  low 
an  altitude,  go  into  irreversible  dives, 
and  more  (all  of  which  I’ve  done) . 

This  is  the  most  impressive  game 
program  I’ve  seen  for  the  ZX/TS.  It’s 
definitely  not  a  make-do-with- 
what-I’ve-got  program.  Rather,  it 
uses  the  ZX/TS  capabilities  well  to 
turn  out  an  excellent  simulation.  This 
program  is  a  terrific  bargain  at  $9.95. 
Thanks  to  Psion  for  making  Flight 
Simulation,  and  to  Sinclair  for  pro¬ 
viding  it  in  the  US. 

Michael  Roberts 
Des  Moines,  IA 


New  Calc 


Name:  VU-CALC 
Type:  Business/Financial 
ROM/RAM  required:  8K/16K 
(ZX81  or 
TS1000  only) 

From:  Sinclair  Research  Ltd. 

3  Sinclair  Plaza 
Nashua,  NH  03061 
or 

Stanhope  Road 
Camberley,  Surrey 
England  GU15  3PS 
Written  by:  Psion  Software 
Price:  $14.95  or  £7.95 


VU-CALC  is  a  program  to  cal¬ 
culate  and  display  tables  of  numbers 
and  names.  The  basic  table  consists 
of  a  grid— 26  rows  labelled  A  to  Z 
and  36  columns  labelled  01  to  36. 
The  grid  size  is  fixed,  so  you  must 
load  and  save  the  entire  grid, 
whether  you  need  it  or  not. 

Loading  a  VU-CALC  tape  with  no 
data  takes  about  two  and  a  half  min¬ 
utes.  Once  you  enter  even  one  num¬ 
ber,  the  program  dimensions  the 
grid.  To  save  and  load  a  program 
containing  any  amount  of  data  takes 
six  minutes. 


This  grid  is  displayed  in  segments  of 
nine  rows  and  three  columns  (see  Fig¬ 
ure  1).  Fortunately,  scrolling  is  rapid 
so  you  can  access  any  grid  position 
quickly.  VU-CALC  treats  titles  as  data 
and  scrolls  them  off  the  screen.  But 
you  quickly  get  used  to  this  and  learn 
to  equate  grid  designations  with  titles. 

For  each  grid  position  you  want 
the  computer  to  calculate,  you  must 
provide  a  formula.  A  formula  con¬ 
sists  of  grid  designations,  constants  if 
necessary,  and  any  of  the  arithmetic 
operators  +  (add),  -  (subtract),  * 
(multiply)  and  /  (divide).  E$ch  for¬ 
mula  can  contain  a  maximum  of  32 
characters.  Since  each  grid  designa¬ 
tion  requires  three  characters,  you 
can  add  together  a  maximum  of 
eight  rows  or  columns,  for  example, 
A02  +  B02  +  C02  4-  D02  +  E02  + 
F02  +  G02  -I-  H02.  Fortunately  you 
don’t  need  to  type  this  lengthy  for¬ 
mula  at  each  grid  position  you  need 
to  compute.  VU-CALC  can  repeat  a 
formula  along  a  row  or  column.  It 
can  be  repeated  absolutely  (exactly 
as  entered)  or  relatively  (with  the  grid 
designations  incremented  appropri¬ 
ately)  .  Sinclair’s  instruction  sheet 
states  simply,  “You  may  use  up  to  40 


54 


SYNTAX  QUARTERLY/SPRING  1983 


^[SISOFTWARE  REVIEW 


formulae”  and  here  is  where  a  serious 
program  deficiency  arises. 

I  first  interpreted  this  statement  to 
mean  you  can  only  calculate  40  grid 
positions,  but  this  proved  incorrect. 
Apparently  it  means  you  can  enter 
40  different  formulae.  A  formula 
repeated  36  times  along  a  row 
counts  as  only  one  formula. 
Although  you  can  delete  a  formula 
from  a  given  grid  position,  you  can 
never  delete  a  formula  from  the 
subroutine  that  checks  for  the 
40-formula  limit.  This  means  you  will 


Magic  on  Tape 

Name:  Programmers’  Toolkit; 

Graphics  Toolkit 
Type:  Utility 

ROM/RAM  reqd:  8K/16K 
Written  in:  Machine  code 
Listable?  No 
Printed  listing?  No 
Easy  to  load?  Yes 
From:  Softsync  Inc. 

14  E.  34th  St. 

New  York,  NY  10016 
212/685-2080 

Price:  $14.95  each,  2/$25  mail 
order  only 

Programmers’  and  Graphics 
Toolkits  are  two  separate  utility 
packages.  Together  they  form  a 
dynamite  package  to  help  you  write 
professional-looking  programs  for 
your  ZX/TS  computer. 


eventually  reach  an  unrecoverable 
error  condition  where  you  can  enter 
no  more  formulae.  You  can  get  there 
very  quickly  if  you  use  formulae  to 
enter  data  into  your  table.  You  can¬ 
not  know  how  many  formulae  you 
have  entered  (short  of  counting),  so 
the  error  comes  without  warning.  I 
have  written  to  Sinclair  asking  how  to 
recover  from  this  error,  but  they  have 
not  yet  answered. 

Numbers  entered  in  the  grid  are 
aligned  along  the  left  side,  not  along 
the  decimal  point.  You  can  enter  up 


These  toolkits  let  you  store 
machine  code  routines  in  your  com¬ 
puter  to  perform  often-used  tasks  or 
tricks  neatly  and  quickly.  You  load 
each  in  the  usual  way  (one  requires 
an  initial  POKE).  They  move 
themselves  above  RAMTOP,  the 
place  the  computer  thinks  is  the  end 
of  memory.  Then  you  can  enter  or 
load  other  BASIC  programs  as  if  the 
machine  code  routines  were  not 
even  there.  The  machine  code  pro¬ 
grams  are  protected  against  being 
overwritten  by  BASIC  programs.  But 
whenever  you  need  a  toolkit  routine, 
just  enter  the  appropriate  USR  call 
and  it  executes. 

You  can  use  each  toolkit  sepa¬ 
rately  or  both  together;  they  are 
compatible.  Each  comes  with  cards 
giving  loading  tips,  directions,  com¬ 
mand  summaries,  and  examples  for 
you  to  try  out.  Be  careful  when 


to  eight  numbers  in  each  grid  posi¬ 
tion.  Calculation  attempted  on  a  grid 
containing  an  alphabetic  character  or 
an  empty  grid  position  produces  a 
C/5110  error.  Load  empty  grid  posi¬ 
tions  with  zeros  if  you  wish  tp  include 
them  in  calculations. 

Instructions  supplied  by  Sinclair 
consist  of  seven  sheets  sized  to  fit  in 
the  tape  box.  Rather  than  teach  you 
how  to  use  the  program,  they  give 
you  just  enough  information  to  let 
you  experiment  and  teach  yourself. 

VU-CALC  is  written  in  machine 
code  and  runs  adequately  fast  except 
when  you  enter  formulae  or  data. 
You  must  pause  between  each  key¬ 
stroke  when  entering  data  to  keep  it 
from  getting  lost.  Possibly  this  delay 
is  not  noticeable  with  the  standard 
ZX/TS  keyboard,  but  anyone  with  a 
typewriter-style  keyboard  will  cer¬ 
tainly  notice  it.  A  numeric  keypad 
would  be  useless  for  entering  data 
due  to  the  program’s  slow  response. 

Although  VU-CALC  has  several 
shortcomings,  it  is  a  very  useful  tool 
for  anyone  who  has  to  work  with 
tables  of  numbers.  If  Sinclair  or  Psion 
can  resolve  the  “over  40  formulae” 
error  condition,  I  will  give  VU-CALC 
a  high  recommendation. 

D.V.  Carville 
APO  New  York 


following  the  directions.  I  found 
three  errors  in  the  instructions  for  the 
first  graphics  routine.  They  are  sim¬ 
ple  to  find  and  fix;  two  are  left-out 
greater  than  and  less  than  signs,  the 
third  is  an  extra  character/  in  a  line 
number  (105  should  be  15). 

One  particularly  good  feature  is 
the  Graphics  Toolkit’s  error  mes¬ 
sages.  If  you  make  a  mistake  using  a 
routine  you  aren’t  likely  to  crash  the 
machine.  Instead  you  get  a  report 
code  akin  to  the  computer’s  own, 
telling  you  the  error  and  the  line 
number  it  occurred  in.  Toolkit  error 
codes  use  letters  G  to  S,  so  they 
don’t  coincide  with  the  computer’s 
own  error  codes. 

Programmers’  Toolkit  offers  these 
routines:  line  renumbering  (also  re¬ 
numbers  GOTOs  and  GOSUBs), 
search  and  replace,  search  and  list, 
hypergraphics  mode  (alters  the 


SYNTAX  QUARTERLY/SPRING  1983 


55 


^  g  SOFTWARE  REVIEW 


starting  address  of  the  character  set) , 
screen  fill,  reverse  video,  wait  (pro¬ 
grams  holds  until  the  computer  re¬ 
ceives  input  from  the  tape  recorder) 
and  bytes  free. 

Graphics  Toolkit  offers  23  routines 
in  all:  draw/undraw  (define  your  own 
shapes), .foreground  on/off,  border/ 
unborder,  screen  fill,  reverse  video, 
up/down/left/right  (alter  next 
PRINT  position),  editprint  (changes 
current  PRINT  position  to  screen  line 
23),  upscroll,  downscroll,  rightscroll, 
leftscroll,  onscreen/offscreen  (turns 
screen  display  on  and  off),  back¬ 
ground  on/off,  search  and  replace, 
and  square  (draws  a  square  or  rec¬ 
tangle  to  specified  coordinates). 

Each  program  requires  a  16K 
RAM  pack  because  of  the  RAMTOP 
adjustment.  Using  the  two  toolkits 
together,  you  still  have  about  13. 5K 
of  memory  available. 

With  the  USR  calls  to  the  machine 
code  routines,  you  effectively  add  32 
commands  to  the  Timex  Sinclair 
BASIC  command  set.  Although  the 
instruction  cards  are  concise,  they 
offer  no  one-location  summary  of  all 
the  USR  commands. 

These  two  tapes  can  give  you  the 
memory  conservation  and  quickness 
of  machine  code  routines  without  the 
aggravation  of  learning  to  program 
yourself  or  the  drudgery  of  POKEing 
in  someone  else’s  machine  code.  I 
really  enjoyed  the  “magic”  I  could 
call  up  with  a  few  keystrokes. 


SINCLAIR /c^kT,ME  t,mzex8%1o 

I/O  Board  with  our  Real  Time  Clock /calendar 

Time _ Month _ Date _ Year _ Day  ot  Week 

23:59:59  12  31  99  7 

Features 

•  8  Outputs  capable  of  driving  relays 

•  8  TTL  inputs 

•  Feed  through  Sinclair  Bus  connector  to 
allow  normal  expansion 

•  Battery  back-up  for  clock 

•  Expandable  Ports 

•  All  software  included 

•  90  day  warranty 
Future  Products 

•  Touch  Tone'“  encoder/decoder 

•  Speech  and  Sound  synthesizer 


MODEL 

DESCRIPTION 

PRICE 

Built  & 
Tested 

Bare  PCB 
&  Manual 

310 

315 

MASTER  I/O  WITH  CLOCK 

$59.95 

$24.95 

MODEL  310  ACCESSORY  BOARDS 

320 

330 

340 

325 

A  to  D  and  D  to  A  converter 

Wireless  control  system  (BSR’“) 

Solid  State  AC  Relay 

$47.95 

$19.95 

$69.95 

$19.95 

SPE 

CIALIZED  PARTS  FOR  MODEL  315 

316 

317 

Sinclair  edge  connector,  46  pin  w/key  $12.95 
Clock  1C  and  crystal  (tested)  $  4.95 

California  residents  add  6%  Shipping  and  handling  $  3.95 


Send  self  addressed 

stamped  envelope  VVB 

for  catalog.  P.O.  Box  3295 

Escondido.  CA.92025-0580 

VISA/MASTERCARD  (619)  741-5132  (24  Hr  Order  Line) 


Go  FORTH 

Name:  ZXFORTH 
Type:  Language 
ROM/RAM  required:  8K/16K 
Written  in:  Machine  Code 
Listable?  No 

Easy  to  load?  Moderately 
Printed  listing?  No 
Documentation:  Poor 
By:  International  Publishing  & 
Software  Inc. 

From:  Gladstone  Electronics 
1585  Kenmore  Ave. 

Buffalo,  NY  14217 
716/874-5510 
or  1736  Avenue  Road 
Toronto,  Ontario 
Canada  M5M  3Y7 
416/787-1448 
Price:  $29.95 

ZXFORTH  ads  boast  the  “simpli¬ 
city  of  BASIC  with  the  speed  of 
machine  code.”  Although  I  can  see 
some  uses  for  ZXFORTH,  simplicity 
is  not  among  its  virtues. 

This  operating  system/language 
comes  on  cassette  with  a  56-page 
manual  and  a  5-page  editor  manual. 
Instructions  for  loading  both  ZX¬ 
FORTH  and  the  EDITOR  appear  on 
the  inside  front  cover  of  the  FORTH 
manual.  This  is  about  the  only 
tutorial  material  presented  in  either 
book.  They  are  reference  manuals, 
and  as  such  will  probably  prove  too 
obscure  for  those  with  no  knowledge 
of  FORTH. 


VOTEM  Lets  Your 
Computer  See/$|fe\ 
The  World  W; 

Analog  Interface/Tape  Signal  Conditioner 

(Tor  the  Timex/Sinclair  Computer) 

VOTEM  is  a  complete  package  consisting  of  hard¬ 
ware  and  software  that  enables  your  computer  to 
measure,  display  and  record  "real  world''  analog  sig¬ 
nals.  Your  computer  can  monitor  any  physical  phen¬ 
omenon  (pressure,  light,  temperature,  etc.)  repre¬ 
sented  by  a  DC  voltage.  A  probe  is  provided  for  air  and 
liquid  temperature  measurements. 

Your  computer  becomes  a  "smart'  digital  voltmeter 
and  thermometer  with  storage  capability.  Use  VOTEM 
in  a  home  energy  conservation  project  to  save  money 
and  possibly  qualify  for  an  energy  tax  credit. 

VOTEM  also  cleans  up  the  tape  signal  for  reliable 
LOADS.  With  VOTEM  you  can  LOAD  tapes  with  a 
lower  volume  setting  on  your  tape  recorder. 

VOTEM  requires  no  mods,  does  not  use  the  com¬ 
puter's  rear  expansion  connector  and  works  with  1  K 
RAM  (or  more). 

VOTEM  is  low  priced  at  only  $59.95  (assembled 
and  tested).  For  an  even  better  bargain  the  VOTEM  kit 
is  only  $39.95.  (Requires  soldering  and  appx  2  hrs.) 
VOTEM  comes  with  a  detailed  35-page  manual.  The 
manual  may  be  purchased  separately  for  $5  pp  and 
applied  to  first  purchase  of  a  VOTE  M  unit.  If  you  are  not 
satisfied  with  VOTEM  return  within  1  5  days  for  full 
refund.  (Does  not  apply  to  kits).  Send  check  or  money 
order  plus  $3  for  shipping  and  handling. 

Down  East  Computers 

P.O.  Box  3096/Greenville,  N.C.  27834 


Experienced  FORTH  users  may 
have  no  trouble  adjusting  to  ZX¬ 
FORTH,  but  most  likely  will  consider 
the  implementation  insufficient.  The 
editor  uses  line-by-line  (not  screen- 
oriented)  techniques;  the  badly 
organized  manual  is  written  for  the 
wrong  computer  in  parts  (containing 
many  references  to  ASCII  characters 
not  appearing  on  ZX/TS)  and  gives 
examples  that  do  not  work. 

I  always  find  it  difficult  to  work  with 
any  language  stored  in  RAM  on  a 
typically  ROM-based  system, 
because  every  time  the  computer 
crashes  I  must  reload  the  entire 
language  in  addition  to  my  pro¬ 
grams.  This  shouldn’t  pose  a  prob¬ 
lem  for  a  nice  solid  interpreter  (how 
often  does  BASIC  crash?),  but  ZX¬ 
FORTH  doesn’t  fit  the  bill. 

To  anyone  unfamiliar  with 
FORTH,  this  package  bewilders. 
Suddenly  you  must  understand  com¬ 
plicated  stack  operations,  strange  ter¬ 
minology  and,  worst  yet,  many 
technical  inaccuracies.  On  the  other 
hand,  if  you  already  know  FORTH 
or  really  want  to  learn  it  on  your 
ZX/TS,  ZXFORTH  will  probably 
work  for  you.  The  power  is  there  if 
you  can  figure  out  how  to  use  it. 

ZXFORTH  works.  Because  of  the 
interpretation  techniques,  it  is  flexible 
and  fast.  But  if  you  expect  to  learn 
FORTH,  look  elsewhere  for  your 
text.  These  manuals  will  not  lead  you 
by  the  hand. 

for 

TIMEX/SINCLAIR 


computers 

LOSTIN  SPACE  (uses  SLOW) .  11.95 

UNIVERSAL  INVENTORY  FILE . 16.95 

UNIVERSAL  MAILING  LIST . 10.95 

UNIVERSAL  COIN  COLLECTION . 10.95 

UNIVERSAL  STAMP  COLLECTION . 10.95 

UNIVERSAL  COMIC  BOOK  COLL . 10.95 


UNIVERSAL  BASEBALL  CARD  COLL  .  .  .  10.95 
UNIVERSAL  RECORD  ALBUM  COLL  .  .  .  10.95 

Each  program  on  cassette  + 
manual.  (8K  ROM,  16K  RAM) 
Please  add  $1.50  for  shipping  and 
handling.  N.J.  residents  add  5% 
tax. 

M.C.  HOFFMAN  CO. 

P.O.  BOX  117 
OAKLAND,  N.J.  07436 


56 


SYNTAX  QUARTERLY/SPRING  1983 


HARDWARE  REVIEW 


The  Parallel  Connection 


Product:  Memotech  Parallel  Inter¬ 
face  and  Seikosha  GP100A 
Printer 

From:  Memotech  Corp. 

7550  W.  Yale  Ave.  Suite  200 
Denver,  CO  80227 
303/986-1516 

Price:  $408.95  for  I/F,  cable  and 
printer,  including  shipping 

After  my  large  box  from  Memo¬ 
tech  arrived,  I  examined  the  com¬ 
ponents:  a  Memotech  I/F,  cable  and 
80-column  printer. 

I/F  stands  for  interface,  computer 
jargon  for  the  connection  between 
your  ZX81  or  Timex  Sinclair  1000 
and  the  printer.  Memotech’s  interface 
is  Centronics  parallel-equivalent.  So 
any  printer  that  uses  a  parallel  printer 
port  (one  of  two  common  standard 
ports)  will  work  with  it.  This  interface 
uses  decimal  addresses  10500  to 
11500.  With  a  64K  RAM  pack  you 
must  only  turn  off  the  8-12K  area 
because  the  addressing  is  fully  de¬ 
coded.  As  with  all  Memotech  prod¬ 
ucts,  the  I/F  sandwiches  with  other 
Memotech  products  (the  I/F  must 
plug  into  the  computer  before 
anything  else).  The  product  pack¬ 
aging  is  Memotech’s  standard  black 
anodized  case.  The  interface  is  FCC- 
approved  for  RF  noise. 

Then  I  unwrapped  the  cable.  It’s 
made  by  3M  and  has  34  pins  on  one 
end,  36  pins  on  the  other.  The 
36-pin  end  goes  to  the  printer. 

Finally,  the  printer  emerged.  It  is 
the  same  as  Radio  Shack’s  Line 
Printer  7,  which  sells  for  $399.  It  is 
pin-feed  only  and  prints  about  30  cps 
(characters  per  second),  giving  80 
columns  in  a  5x7  dot  matrix.  The 
printer  runs  a  little  noisy,  even  with 
the  sound  baffle  on.  You  can  get  all 
the  paper  or  ribbons  you  need  at 
Radio  Shacks  anywhere. 

Once  I  connected  everything  I  was 
able  to  print  in  minutes.  The  I/F  uses 
all  the  keyboard’s  printer  com¬ 
mands— no  USR  calls  here.  All 
ASCII  control  codes  are  preceded  by 
an  inverse  period.  Or  you  can  use 
the  CFIR$  of  the  Sinclair  code  cor¬ 
responding  to  that  character.  Lower 


case  characters  are  represented  by 
inverse  graphics.  For  example,  in¬ 
verse  B  prints  as  “b”. 

I  have  used  my  printer  for  a  month 
or  so  with  no  problems.  The  entire 
package  costs  $408.95  and  offers  a 
96-character  ASCII  character  set 
with  lower  case,  double-wide  charac¬ 
ters,  and  dot-addressable  graphics. 
In  addition,  it  can  print  Memotech’s 
hi-res  screen.  You  get  80-column 
printouts  for  LLIST  and  LPRINT; 
COPY  gives  you  exact  screen  image. 

For  the  price,  you  can’t  beat  it. 


Having  gained  considerable  prac¬ 
tice  with  this  unit,  I  will  now  pass  on 
my  experience  to  you: 

1.  Memotech’s  literature  does  not 
go  into  detail  about  ASCII  control 
codes.  Check  at  computer  stores  to 
locate  a  good,  detailed  code  guide. 
Be  sure  to  check  all  codes  against 
your  printer’s  guide  because  some 
codes  differ.  For  example,  with  the 
Seikosha  printer  change  the  follow¬ 
ing:  inverse  period  8  — graphics 
mode;  inverse  period  A— NEWLINE 
or  ENTER;  inverse  period  G  —  POS. 


10  RFH 

IS  LET  8  =  16514. 

20  INPUT  R 
30  POKE  B  R 

4-0  XF  i-j -t?  THEN  GOTO  ISO 
50  LET  B=B+1 
50  GOTO  20 
100  LPRINT  CHS $  6 


Program  1 


SYNTAX  QUARTERLY/SPRING  1983 


57 


BYTE-BACK  modules 


64- K  MEMORY  $119.?? 


INSTANT  INFORMATION 

WITH 

BYTE-BACK’S  MD-1 

MODEM  only  $119  ■ KIT 

WIRED  AND  TESTED  $149.95 


Use  your  phone  to  connect  your  “LITTLE”  computer  to 
the  “LARGEST”  computer  networks  in  the  world,  With 
BYTE-BACK’s  MD-1  MODEM  connected  all  you  do  is  dial 
a  phone  number  (usually  local),  press  a  few  keys  and  watch 
the  data  appear  on  your  TV  screen.  (Software  is  included) 
This  MODEM  can  be  used  in  either  the  “originate”  or 
“answer”  mode  with  selectable  baud  rate. 

You  can  have  immediate  access  to: 

UNIVERSITY  COMPUTERS.DOW  JONES. 

COMPUSERVE  &  SOURCE 

As  an  extra  bonus  an  RS-232  port  is  provided  to 
allow  you  to  drive  all  standard  RS-232  peripherals  & 
printers.  (75  to  9600  Baud) 


BYTE-BACK’S  BB-1 

CONTROL  MODULE 

$59.00  in  stock! 

WIRED  and  TESTED  $69 

•  8  Independent  Relays 

(with  LED  status  indicators) 

•  8  Independent  TTL  Inputs 

(with  Schmitt  trigger  buffers) 

•  By  using  a  single  POKE  command 
you  can  change  and  latch  the  status 
of  each  of  the  8  relays. 

•  Your  computer  can  read  the  status 
of  all  8  inputs  by  the  use  of  single 
Peek  command. 

•  A  comprehensive  manual  is  in¬ 
cluded  that  has  complete  application 

_  details. 


WIRED  and  TESTED  $129.95 

INSTOCK! 

SAME  DA  Y  SHIPMENT! 

WHY  PAY  MORE? 

BYTE-BACK’S  M-64  extends  the  memory  of  your  ZX81  or 
Timex-Sinclair  1000  to  a  full  64-K.  It’s  user  transparent.  It 
plugs  directly  into  the  back  of  the  ZX81  and  has  an 
expansion  port  to  allow  you  to  still  use  a  printer.  No  extra 
power  supply  is  required. 


All  Memories  have  extra  tight  contacts  in  the  connector. 
This  combined  with  a  flat-bottom  metal  case,  provide  the 
shielding  and  stability  needed  to  completely  eliminate 
memory  “crashes”  common  with  other  memory  modules. 


EXPAND  YOUR  16K  SYSTEM 
(M-16)  $59,95 

WIRED  and  TESTED  $69.95 

If  you  have  a  Sinclair  16K 
RAM  module  and  need  more 
memory,  expand  it  to  32K  and 
beyond  by  using  BYTE-BACK 
M-16  MEMORY  MODULES. 

You  can’t  connect  two  Sin¬ 
clair  16K  RAM  modules  together,  but  you  can  connect 
one  Sinclair  16K  and  one  or  more  BYTE-BACK  16K 
modules  to  get  all  the  memory  you  need. 

THOUSANDS  IN  USE  WITH  PROVEN  RELIABILITY 
IN  STOCK  —  SAME  DAY  SHIPMENT 


Don’t  settle  for  a  poor  quality  printer .  .  . 

RS-232  Module  $59.?!? 

WIRED  AND  TESTED  $69.95 

Allows  you  to  connect  to  all  RS-232  printers  &  terminals. 


ALL  MODULES  CARRY  90-DAY  WARRANTY 

Schematic  &  Manual  included  with  all  bd.s  and  urtits. 
TRY  BYTE-BACK  MODULES  FOR  10  DAYS  WITH  NO  OBLIGATION 


UJ  h- 
.  “  O  CM 

O  Q  o>  i- 
OO"  ® 

X  J9(M 


wSk  £ 

^  z  <  z 

S  5  D 

O  UJ  i  - 

w  >  z  08 

II  O  h  J 

■  H  o  c  o 

;  D  .  §  O 
a.  c/>  2  i 
:U 

i  O  uj  to 


Remember  with:  BYTE-BACK  modules  you  are  NOT  limited  to  using  only  one  module  at  a  time! 


h-  x  >  ^ 
O  C/>  JZ 

m  CD  UJ  q. 


0-  Z  <  gQ 


o  w  - 

0CDCQS 

UJ  .  UJ 

(5  — 1  to  i 

^  D  UJ  o 

m  Q  o  d 

w  °  z  iu  , 

h  2  uj  □  I 

>  a  _l  ; 

CD  ofi  <  <  l 


□  M-64  Kit .  $119.95 

□  M-64  Wired  and  Tested . $129.95 

□  M-64  Blank  PC  Board .  $19.95 

□  BB-1 .  $59 

□  BB-1  Wired .  $69 

□  BB-1  Blank  PC  Board .  $19.95 


ORDER  PHONE  (803)  532-5812  Bill  My 


□  M-16  Kit .  $59.95 

□  M-16  Wired  and  Tested .  $69.95 

□  M-16  Blank  PC  Board .  $19.95 

□  iModem  Kit . $119.95 

□  IModem  Wired  and  Tested . $149.95 

□  IRS-232  Module  Kit .  $59.95 

□  RS-232  Module  Wired  and  Tested .  $69.95 

Shipping  and  Handling  $4.95 
□  Visa  □  MasterCard 


Exp.  Date _ Card  No.  _ 

Name _ 

Address _ 

City/State/Zip _ : _ 

Mail  To:  BYTE-BACK  CO.*  RT.  3  BOX  147  •  BRODIE  RD.  •  LEESVILLE,  S.C.  29070 

DEALER  DISCOUNT  AVAILABLE 


CHECKS 

■■l/OC'N] 

fC4  MosteCard 


58 


SYNTAX  QUARTERLY/SPRING  1983 


£HjfM  HARDWARE  review 


2.  When  using  LPRINT  and  TAB 
you  can  only  TAB  32  positions.  To 
use  the  printer’s  full  width,  substitute 
LPRINT  “inverse  period  Gxx”; 
“Data”  where  xx  is  0  to  80.  This 
prints  at  character  position  xx. 

3.  Instructions  from  Memotech  do 
not  directly  tell  you  how  to  use  the 
printer’s  dot-addressable  graphics 
feature.  But  one  part  shows  how  to 
POKE  codes  into  a  REM  statement 
and  print  symbols  for  these  values. 
That’s  how. 

To  demonstrate,  key  in  program 
1.  Line  10  contains  50  repetitions  of 
the  letter  A  (any  character  would 
do).  Line  15  starts  at  the  first 
memory  address  after  the  REM  in 
line  10.  A  in  line  20  is  the  decimal 


Product:  Floppy  Interface  for  ZX81 
(FIZ) 

From:  Macronics  Systems  Ltd. 

26  Spiers  Close 
Knowle,  Solihull 
West  Midlands,  UK  B93  9ES 
Price:  $149  for  card  only,  $35  for  ex¬ 
pansion  bus.  Shipped  airmail 
at  no  extra  charge. 

Macronics’  is  the  first  disk  drive 
interface  that  appeared  for  testing 
with  ZX81  computers.  The  interface 
card  (5x5V2  inches)  fits  onto  a 
motherboard  so  you  can  use  a 
printer  and  external  RAM  pack.  Any 
RAM  pack  that  lets  you  switch  off  the 
8-12K  region  of  RAM  will  work  with 
this  system. 

You  can  supply  your  own  disk 
drive  or  get  one  from  Macronics. 
Theirs  is  a  standard  5V4  inch  floppy 
drive.  (According  to  Ken  MacDonald 
of  Macronics,  their  3-inch  drives 
should  be  available  around  March, 
1983.  In  the  US,  a  Shugart  SA400 
or  equivalent  can  work  with  this 
interface  — Ed.)  A  21-inch  cable 
couples  the  drive  to  the  interface 
card.  This  cable  is  more  than  ample 
to  move  the  disk  unit  into  an  easy 
working  position. 


number  you  will  enter.  Line  30  puts 
each  decimal  number  in  a  memory 
location.  Line  40  checks  for  a  zero 
input  (0  tells  the  subroutine  to  exit 
and  print). 

Now  RUN  the  program.  Enter 
each  decimal  number  following  (hit 
NEWLINE  or  ENTER  after  each): 

8  (puts  printer  in  graphics  mode) 
27  (ESCape,  when  followed  by 
POS  specifies  dot-address) 

16  (POSition) 

1  (High  Point) 

100  (Low  Point) 

2,  255,  186,  160,  178,  191,  178, 

160,  178,  191,  178,  160,  186, 

255,  2  (graphics  data— see 
manual) 

0  (tells  subroutine  to  exit  and 
print) . 


Fiz-zy  Floppy 

You  switch  on  the  disk  drive 
before  applying  power  to  the  com¬ 
puter.  Here  I  ran  into  my  first  prob¬ 
lem— there  is  no  way  to  tell  that 
everything  is  alright.  Usually,  a  disk 
system’s  software  first  tests  the  drive 
so  you  hear  the  motor  when  you 
switch  on  the  power.  Not  so  on  the 
Macronics  drive.  You  might  expect 
to  see  the  LED  on  the  front  light 
when  the  power  comes  on.  Not  so. 
This  LED  only  comes  on  when  the 
computer  uses  the  drive.  In  fact,  this 
software  only  responds  to  USR  calls; 
otherwise  it  is  inactive. 

To  use  this  system,  you  need 
single-sided,  single-density,  hard 
sectored  disks.  These  disks  are  di¬ 
vided  into  10  sectors.  Because  each 
disk  contains  35  or  40  tracks,  you  get 
350  or  400  segments  of  data,  but 
each  file  must  use  a  whole  number  of 
tracks.  With  35-track  disks,  you  get 
42. 5K  bytes  maximum  storage; 
48.75K  with  40-track  disks.  Each 
data  segment  is  128  bytes  long.  The 
whole  first  track  is  used  for  the  direc¬ 
tory.  This  leaves  you  with  no  more 
than  48K  on  each  disk  and  no  more 
than  39  files  per  disk.  Of  course,  you 
can  swap  disks  during  a  program  for 
greater  storage  capacity. 


High  Point  (HP)  and  Low  Point  (LP) 
combined  form  a  4-byte  dot  address 
that  can  range  from  0  to  479  decimal 
or  01DF  hex  (the  dot-address  of  the 
last  character).  Here  is  the  snag.  HP 
must  equal  either  00  hex  (if  the  ad¬ 
dress  is  less  than  256)  or  01  hex  (if 
the  address  is  greater  than  or  equal 
to  256).  Yet  if  you  enter  00,  the 
subroutine  exits  and  you  get  no  print. 
The  printer  only  checks  whether  bit  7 
of  the  HP  is  on  or  off.  Instead  of  00 
hex,  enter  16  decimal.  For  01  hex 
enter  01  decimal.  LP  can  be  any 
number  between  0  and  255  decimal, 
or  00  and  FF  hex. 


Jeff  Pack 
Auburn,  WA 


Disk  systems’  speed  usually  at¬ 
tracts  people,  but  this  one  is  SLOW 
compared  to  most.  Software  entirely 
controls  the  disk— there  is  no  con¬ 
troller  board. 

This  system  takes  24  seconds  to 
load  a  16K  program  from  disk  into 
memory.  (MacDonald  says  it  takes 
18  seconds — Ed.)  Although  this 
speed  is  21  times  the  speed  of 
cassette  loading,  it  is  six  times  slower 
than  Sinclair’s  forecast  ZX  Spectrum 
Microdrive  and  60  times  slower  than 
normal  disk  drives  for  other 
computers. 

Despite  the  slow  speed,  Mac- 
ronic’s  disk  system  is  ideal  for  ZX/TS 
users.  It  is  simple  to  operate  and 
understand. 

Technical  Details 

Files  always  use  a  whole  number 
of  tracks  and  your  program  must  dis¬ 
cern  what  data  is  in  each  sector  of  the 
file.  The  disk  system  provides  10 
commands  that  you  can  use  in  pro¬ 
grams  via  one  USR  call  to  Macronic’s 
4K  ROM  on  the  interface  board.  This 
command,  LET  E  =  USR  9999, 
should  be  the  first  line  of  any  pro¬ 
gram.  All  other  commands  are  then 


SYNTAX  QUARTERLY/SPRING  1983 


59 


ij^lcTH  ARP  WARE  REVIEW 


available  as  USR  calls  to  the  ROM 
using  letters  or  words  instead  of 
numbers.  For  instance,  USR  DIR 
calls  the  directory  (2-second  access 
time),  which  prints  disk  contents  on 
the  screen  by  file  name  only.  DIR  has 
no  effect  on  your  program  except  to 
clear  the  screen.  You  can  COPY  the 
directory  listing. 

Each  file  name  consists  of  six  let¬ 
ters,  no  spaces,  followed  by  a  full 
stop  (period).  Then  comes  a  three- 
letter  description  of  the  file  type 
(DAT  for  data,  BAS  for  BASIC,  for 
example).  You  can  invent  your  own 
codes  if  you  like. 

To  create  data  files,  you  must  first 
give  variable  F$  the  name  of  the  file 
in  the  format  just  described.  Then 
assign  the  number  of  sectors  required 
(in  multiples  of  10)  to  variable  R.  The 
command  LET  E  =  USR  CREATE 
will  then  make  a  new  file.  If  a  file  of 
the  same  name  exists,  the  system  will 
not  overwrite  it,  but  return  the 
variable  E  with  an  error  code.  You 
can  only  copy  a  file  by  giving  it 
another  name  and  only  destroy  it  by 
a  KILL  command. 

READ  and  WRITE  use  variable 
R$,  which  has  been  dimensioned  to 
be  1x128  bytes  long  to  read  and 
write  sectors  into  and  out  of 
memory.  You  use  R  for  the  number 
of  sectors  required  and  F$  for  the  file 
name.  R  may  not  be  a  FOR-NEXT 
loop  variable. 

ST  AT  gives  the  disk  status.  If 
F$  =  “”  (no  file  name),  ST AT  gives 
the  number  of  free  sectors  on  the 
disk.  If  F$  contains  a  file  name, 
ST AT  returns  the  number  of  sectors 
that  file  uses. 

DSAVE  and  DLOAD  do  the  same 
as  on  the  cassette,  so  you  can  LOAD 
files  into  the  computer  from  tape  and 
DSAVE  them  onto  disk.  You  can 
also  make  programs  auto-run. 

NEWD  initializes  a  new  disk,  filling 
every  sector  with  check  characters 
and  writing  out  the  directory  track. 

The  supplied  interface  card  has  2K 
RAM  for  use  as  work  space  for  the 
disk  at  14-16K.  It  also  contains  a  4K 
ROM  using  addresses  8-12K.  (Ac¬ 
cording  to  Ken  MacDonald,  the  FIZ 
uses  240  bytes  of  ZX/TS  RAM  in  the 
variables  region  — Ed.) 


Conclusions 

This  disk  system  in  no  way  rivals 
Sinclair’s  Spectrum  Microdrive 
(when  available) .  Sinclair’s  Micro¬ 
drive  will  not  work  with  ZX81s  or 
TSIOOOs  and  will  beat  Macronics’ 
drive  both  in  capacity  (100K  per 
disk,  eight  drives)  and  price  (about 
£50,  or  $82  US). 

However,  the  ZX81  (and  TS1000) 
is  well  used  all  over  the  world  and  the 
Spectrum  has  been  only  available  in 
the  UK.  ZX/TS  users  who  do  not 
want  to  change  their  machine  and 
software  will  find  this  a  very  useful, 
but  expensive  way  to  speed  up  data 
processing. 


Keyboard 

Product:  Auto  Shift  Keyboard  Kit  for 
ZX/TS 

From:  Research  Applications 
Products 

4561  Paloma  Lane 
Yorba  Linda,  CA  92686 
Price:  Kit  $80 

Board  and  Key  Legends  $30 

I  picked  up  my  keyboard  kit  at 
Research  Applications,  so  I  did  not 
have  to  wait  for  mail  order  delivery. 
Although  you  can  buy  the  PC 
(printed  circuit)  board  and  key 
legends  for  $30,  I  opted  for  the  com¬ 
plete  kit.  Compared  to  rounding  up 
the  remaining  components,  the 
savings  didn’t  seem  worth  the  hassle. 

One  double-sided  PC  board,  73 
keys  and  key  caps,  7  CMOS  ICs  and 
sockets,  27  resistors,  27  diodes  and 
mylar  key  legends  make  up  the  kit.  It 
does  not  come  with  an  enclosure, 
but  this  was  no  problem  — it  fits  easily 
into  a  surplus  enclosure  I  bought 
locally  for  $6. 

Construction  time  was  about  four 
hours— there  are  134  components 
and  73  separate  key  legends  to 
mount. 

Keyboard  connection  to  the  com¬ 
puter  is  via  ribbon  cable  which  you 


There  are  a  few  things  I’d  like  to 
see  Macronics  change: 

1.  An  at-a-glance  list  of  commands 
would  be  better  than  leaving  the 
commands  spread  throughout  the 
manual. 

2.  A  POWER  ON  indicator  would 
be  useful  on  the  disk  drive. 

3.  Arrangements  should  be  made  to 
have  48K  RAM  packs  available  for 
use  with  the  system. 

4.  Use  DIM  R$(l,128)  instead  of 
DIM  R$(128).  This  would  allow  users 
to  INPUT  directly  to  the  variable  used 
by  the  disk  and  save  memory. 

Stephen  Adams 
London,  England 


Quickness 

solder  to  the  board  at  one  end.  You 
then  strip  and  tin  the  connectors  on 
the  other  end  before  inserting  them 
into  existing  sockets  on  the  com¬ 
puter.  (The  connectors  are  on  0.1 
inch  centers  and  slip  directly  into  the 
sockets.) 

For  ease  of  use,  I  replaced  the  kit’s 
ribbon  connector  with  a  five-foot 
length,  which  resulted  in  the  autoshift 
LPRINT  not  working.  Fortunately, 
the  instructions  addressed  this  prob¬ 
lem.  1  easily  solved  it  by  adding  a 
6.8K  resistor  in  parallel  with  the  10K 
pull-up  resistor  on  the  computer 
KBD0  line. 

My  completed  keyboard  is  profes¬ 
sional  in  appearance  and  extremely 
easy  to  use.  As  advertised,  46  key 
functions  are  automatically  shifted. 
The  keyboard  layout  is  logically  ar¬ 
ranged  with  a  special  graphics  sec¬ 
tion.  The  editing/game  keyrow 
(located  at  the  bottom  of  the  key¬ 
board)  is  a  nice  touch.  This  feature 
gives  you  quick  and  easy  program 
editing  with  single  keystrokes  and 
contains  the  cursor  arrows  used  in 
many  games. 

Don  Parks 
Riverside,  CA 


60 


SYNTAX  QUARTERLY/SPRING  1983 


IMcHbook  review 


Pocket 

Information 

Title:  The  ZX81  Pocket  Book 

Author:  Trevor  Toms 

From:  Reston  Publishing  Co.,  Inc. 

599  Adamsdale  Road 

N.  Attleboro,  MA  02760 
Price:  $10.95 

For  a  128-page  paperback,  $11  is 
a  lot  of  money  to  pay.  But  Trevor 
Toms  has  done  a  good  job  here. 
There  are  a  couple  dozen  programs 
and  subroutines,  mostly  games  but 
also  a  few  handy  utilities:  big  char¬ 
acters,  a  hex  monitor,  and  a  couple 
of  very  nice  routines  for  formatted 
numeric  output  are  included.  All  the 
programs  I  tried  were  good  to 
excellent. 

There  is  also  a  good  deal  of  text 
aimed  at  the  moderately  experienced 
user  who  wants  to  develop  tech¬ 
niques  for  running  faster  programs 
and  using  less  memory,  and  methods 
and  algorithms  for  doing  things  that 
aren’t  completely  straightforward  in 
Sinclair  BASIC.  Anyone  past  the 
beginner  level  will  find  some  useful 
ideas  in  this  book.  For  instance, 
which  is  better:  A  =  B*0.15  or 
A  =  B  *  100/ 15?  Toms  points  out  that 
while  the  first  is  faster,  it  turns  out  to 
be  less  accurate;  INT  (100*0.15) 
returns  a  value  of  14! 

Minor  errors  mar  the  book.  Toms 
originally  wrote  the  book  for  an 
English  audience,  and  this  American 
edition  lacks  some  necessary  correc¬ 
tions.  For  example,  the  statement 
that  FRAMES  is  updated  at  intervals 
of  1/50  of  a  second  was  not  changed, 
though  in  the  American  ZX/TS  com¬ 
puters  it’s  1/60  second.  In  addition, 
in  the  section  on  reducing  execution 
times,  some  benchmark  programs 
are  listed  and  it  says  that  there  is  a 
table  of  timings  at  the  end  of  the 
book.  There  is  not.  Remarkably,  I 
found  no  bug  or  typo  worth  mention¬ 
ing  in  any  of  the  programs— even  the 
long  and  complicated  .  “Adventure 
Master”  given  in  the  last  chapter. 

This  marvelous  program  is,  in  ef¬ 
fect,  an  interpreter  for  a  language  to 
create  adventure-type  games.  Toms 


gives  two  sample  scenarios,  a  tiny 
test  scenario  and  a  more  complex 
one,  “City  of  Alzan.”  The  latter  is 
fairly  simple  but  fun,  and  it  doesn’t 
begin  to  strain  even  a  mere  16K 
RAM’s  capacity.  If  you’d  like  to  make 
your  own  clever  and  complicated 
adventure  game,  this  program 


should  give  you  all  the  tools  you’ll 
need.  This  chance  to  create  your 
own  adventure  game  may  justify  the 
price  of  the  book. 

Richard  S.  Holmes, 

Batavia,  IL 


Know  Your  CPU 


Title:  Z80  User's  Manual 
Author:  Joseph  J.  Carr 
From:  Reston  Publishing  Co. 

A  Prentice-Hall  Co. 

Reston,  VA 

Price:  $10.95  (326  pp.,  softcover) 

In  a  nutshell,  the  Z80  Users  Man¬ 
ual  is  an  excellent  reference  but  not 
an  instruction  manual  for  beginners. 

While  most  Z80  hardware  techni¬ 
cal  manuals  tell  you  what  you  need 
to  know  about  any  given  facet  of  the 
computer’s  operation  in  five  different 
places,  Carr’s  Z80  Users  Manual  tells 
you  everything  you  need  to  know  in 
one  place.  For  instance,  in  the 
description  of  the  memory  refresh 
register  R,  this  manual  tells  not  only 
what  the  R  register  does,  but  that  the 
I  register  is  placed  on  the  high  order 
bits  of  the  address  bus,  and  R  register 
on  the  low  order  bits,  and  that  the  R 
register  does  not  increment  through 
the  eight  bit— all  important  informa¬ 
tion  when  trying  to  understand 
ZX/TS  character  generation  and 
keyboard  scanning.  This  sort  of  infor¬ 
mation  may  be  split  up  in  other  man¬ 
uals,  or  may  not  be  presented  at  all.  I 
wish  this  book  had  been  around 
when  I  learned  Z80  architecture  and 
programming! 

To  understand  the  hardware  sec¬ 
tion,  you  should  have  some  familiar¬ 
ity  with  digital  logic,  since  it  is  used 
extensively. 

The  hardware  section  includes  in¬ 
terfaces  for  RS232  and  current  loop 
devices,  I/O  port  interfacing,  mem¬ 


ory  mapping,  a  good  description  of 
interrupts,  explanation  of  ASCII  and 
EBCDIC  codes  (neither  of  which  the 
ZX81  uses),  and  short  descriptions  of 
the  Z8  and  Z8000  microprocessors, 
which  will  give  you  a  more  worldly 
view  of  microprocessors. 

The  software  section  of  the  manual 
describes  how  addressing  modes 
work,  interrupts  from  a  software 
standpoint,  and,  to  some  degree, 
coding  techniques.  In  the  software 
portion  of  the  book,  Carr  assumes 
you  understand  logical  operators 
(AND,  OR,  etc.);  he  gives  no  expla¬ 
nations  while  using  the  terms. 

The  last  chapter  is  a  comprehen¬ 
sive  description  of  the  Z80  instruction 
set,  similar  to  those  published  in  any 
book  on  Z80  microprocessors,  al¬ 
though  a  little  better  done  than  most. 

This  book  is  not  for  beginners  with 
no  experience  or  concept  of  how 
machine  code  works.  It  may  also  be 
over  the  heads  of  those  just  beginning 
in  digital  circuitry.  It  is  a  very  good 
reference  work  for  those  who  are 
eager  to  learn. 

Carr  presents  concepts  in  a  clear, 
concise  form,  including  everything 
you  need  to  know  on  a  subject  in  one 
place.  This  manual  does  not  tell  you 
amazing  things  people  didn’t  know 
before;  it  retells  the  old  story  in  an 
understandable  form.  A  warning, 
however:  this  book  does  not  deal 
specifically  with  the  ZX81  at  all,  and 
most  of  the  circuits  given  will  require 
some  modification.  In  general,  the 
circuits  are  shown  as  concepts,  and 
therefore  will  not  work  as  is. 


SYNTAX  QUARTERLY/SPRING  1983 


61 


SYNTAX 


Serving  Timex-Sinclair 
Personal  Computers 


A  PUBLICATION  OF  THE  HARVARD  GROUP 

ISSN  0273-2696 


SYNTAX  is  a  monthly  newsletter  exclusively  for  ZX80/ 
81/TS1000  owners.  We  bring  you  news,  reviews  and  ap¬ 
plications  for  your  computer,  plus  technical  notes  for 
circuit-builders.  SYNTAX  also  provides  a  forum  for 
thousands  of  users  to  share  advice  and  problems  about 
programs  and  vendors.  We  bring  you  timely  updates 
about  new  hardware,  software  and  books.  And  we  cover 
all  the  Sinclair-technology  computers,  including  the  new 
TS1000. 

At  SYNTAX  we  emphasize  practicality.  You  can  apply 
our  suggestions  even  if  you  aren’t  sure  at  first  why  they 
work,  because  we  give  you  complete  instructions.  Text  is 
clear  and  easy  to  understand.  SYNTAX  readers  already 
know  about: 

•  An  automatic  phone-dialer  they  can  put  together 
in  a  few  hours 

•  Syntactic  Sums™  to  check  input  for  errors 

•  Programs  to  explore  computer  memory 

•  How  to  build  external  additional  RAM 

•  How  to  add  an  8212  I/O  chip  to  control  external 
devices  from  their  computers 

And  SYNTAX  readers  like  what  they  get  every  month. 
Subscribers  know  they  can  depend  on  us. 

After  receiving  only  three  issues  of  SYNTAX ,  I 
find  that  I  anxiously  await  the  next.  .  .  keep  up 
the  good  work! 

Martin  Irons 
Goshen,  NY 

Congratulations  on  the  brass-tacks,  down-to- 
earth  approach  of  your  newsletter.  Til  be  look¬ 
ing  forward  to  future  issues. 

Otis  Imboden 
Washington,  DC 

Many  readers  get  their  first  issue  and  immediately  order 
the  back  issues— more  proof  that  they  like  what  they  see. 


You  can  see  what’s  special  about  our  publication.  We 
work  hard  to  bring  you  a  quality  newsletter.  We  strive  to 
print  useful  programs  of  above-average  accuracy.  As  any 
computer  magazine  editor  can  tell  you,  program  listing  ac¬ 
curacy  is  tough  to  achieve,  but  we  boost  our  average  with 
every  issue.  We  test  each  program  to  make  sure  it  works, 
it  fits  in  the  designated  RAM,  and  it  runs  when  you  follow 
the  directions.  We  print  program  listings  in  screen-image 
format  to  make  it  easier  for  you  (it’s  sure  not  easier  for 
us!)  to  enter  program  accurately.  We  invented  Syntactic 
Sum™  as  an  additional  aid  for  you  in  getting  error-free 
programs.  With  your  subscription  you  also  get  access  to 
thousands  of  other  readers,  and  our  staff  experts  are 
available  by  phone  to  answer  your  questions  or  help  you 
solve  problems  with  your  machine. 

SYNTAX  readers  get  every  month: 

•  Latest  news  of  Z80  hardware  and  software 

•  Programs  to  organize  information,  calculate, 
entertain,  or  instruct 

•  Do-it-yourself  additions 

•  Clear  explanations  for  beginners 

To  share  the  benefits  of  SYNTAX,  just  indicate  your 
choices  on  the  order  coupon  and  return  it  with  your 
choice  of  payment  in  U.S.  funds.  (Please  note  that  addi¬ 
tional  postage  is  required  for  delivery  outside  North 
America.) 

We  are  so  sure  you’ll  find  SYNTAX  useful  that  we 
promise  to  refund  your  entire  subscription  fee  if  you  aren’t 
satisfied.  An  unconditional  guarantee— you  can’t  lose. 

Join  the  others  who  stretch  the  ZX/TS  to  the  utmost. 
Act  now— as  soon  as  we  receive  your  coupon  with  pay¬ 
ment,  your  first  issue  will  be  on  its  way.  For  faster  service, 
phone  your  credit  card  order  to  617/456-3661.  Don’t 
miss  SYNTAX! 


Fill  out  the  coupon  below  and  mail  it  to:  SYNTAX/SQ,  RD2  Box  457,  Harvard,  MA  01451 


SQ383 


□  My  check  is  enclosed. 
Make  checks  payable  to: 
SYNTAX  ZX80,  Inc. 


□  Pleas(e  charge  my  □  VISA 

□  Diner’s  Club  □  American 
Express  □  Mastercard 

□  Carte  Blanche  account 


Account  number 


YES!  Please  send  me: 

□  The  Combination  (12  issues  of  SYNTAX  and  4  issues 

of  SQ) .  $39 

□  The  Catch-up  (SYNTAX  Jan.  82-Dec.  83,  4  issues  of  SQ, 

plus  1  binder  .  $77 


Exp.  date  _ Bank  number  (MC  only) 

Signature  _ 

Name  _ 

Address  _ 


□  The  Works  (SYNTAX  Nov.  80-Nov.  83,  4  issues  of  SQ, 

plus  2  binders,  a  50%  savings) .  $97 

□  12  issues  of  SYNTAX . .  $29 

□  4  issues  of  SQ,  The  Syntax  Quarterly .  $15 

□  1  Premier  Issue  of  SQ . $4.95 

□  1  Binder  . $9  □  1  issue  of  SYNTAX  .  $4 


City. 


State 


.Zip 


Day  phone  (  )  _ Evening  phone  ( 


These  offers  expire  31  May  83-SUBSCRIBE  NOW. 


□  This  is  a  renewal.  My  subscription  number  is: 

□  This  is  a  new  subscription. 


62 


SYNTAX  QUARTERLY/SPRING  1983 


(^fral  SYNTAX  QUARTERLY 

^~=>  JL^J>  by  The  Harvard  Group 


Increase  Your 
Computer’s  Utility 
With  Our  Help 


You  own  a  powerful  computer,  capable  of  sorting, 
analyzing,  calculating,  displaying  and  manipulating 
data  as  well  as  measuring  and  controlling.  Despite  its 
small  size,  your  computer  will  help  you  learn,  analyze 
your  business,  keep  your  records  or  your  schedule,  dial 
your  phone,  send  messages,  or  talk  to  other  computers. 
To  control  the  power  available  to  you,  you’ll  need  hard¬ 
ware  and  software  to  use  with  your  machine.  Although 
you  can  buy  many  of  these  products— and  we’ll  tell  you 
about  them— some  you  must  create  or  modify  for  your¬ 
self.  SQ  will  provide  you  with  the  complete  information 
to  let  you  use  your  programming  or  tinkering  time 
efficiently. 

Our  experts  also  bring  you  SYNTAX,  the  newsletter, 
for  up-to-date,  concise  information.  You  need  news  and 
new  product  announcements  quickly.  And  SYNTAX 
packs  a  lot  of  information  into  its  brief,  time-saving 
format. 

But  we  recognized  your  need  for  material  too  long  to  fit 
in  SYNTAX.  Syntax  Quarterly  fulfills  that  special  need. 
In-depth,  extensive,  detailed  information— that’s  what 
SQ’s  all  about.  Long  programs,  big  construction  articles, 
and  detailed  directions  help  you  use  your  computer  to  its 
fullest  while  learning. 

SQ  gives  you  tested,  accurate  information  that  you  can 
depend  on.  We  test,  we  build,  we  check  everything  that 
goes  into  SQ.  Our  staff  experts  work  for  you;  it’s  as 
though  your  full-time  staff  prepared  a  report  for  you 
every  quarter. 

At  SQ,  we  specialize  in  your  machine— Timex-Sinclair 
technology.  Our  programs  and  projects  work,  and, 
because  we  test  each  one  before  we  publish  it,  they  work 
on  your  machine.  All  the  information  in  SQ  can  work  for 
you. 

But,  to  capture  these  benefits— free  software,  free 
plans  for  hardware,  free  instruction — you  must  subscribe. 
Use  the  coupon  to  tell  us  how  to  help  you  best.  Or  call; 
we  understand  people  in  a  hurry.  SQ 


1 


100  LET  R*  =  ’ 

200  LET  B$=" 

250  LET  C$="_ 

300  PRINT 
4-00  PRINT  B$].B$ 

500  PRINT  B$(  TO  73 .6$ 

600  PRINT  Bit  TO  73 jet 

70©  PRINT  fii,B$ 

600  PRINT  "  " ; B $  1 2  TO  )  ,Bt 

y00  PRINT  **  TO  }  'b* 

1000  PRINT  B$,B£ 

1100  PRINT 

1200  PRINT  RT  7,22; C* 

1300  PRINT  RT  9,24.:  C* 

14-00  FOR  1=0  TO  24-8 

I >66  RND  I <126  THEN  GOTO 

1600 

1500  PRINT  CHRi  I; 

16©0  NEXT  I 

170©  PRINT  RT  1© ,8;"  UE  SPERK  V 
OUR  LRNGURGE 

SYNTRCTIC  SUM:  22174- ,  BK  ROM 


UE  SPERK  YOUR  LRNGURGE  0123 


— — - J"RT  TRB  7CODE  URL  LEN 

SIN  COS  TRN  RSN  RCS  RTN  LN  EXP 
intsor  SGN  RBS  PEEK  USR  STR*  CH 
R*  NOT  **  OR  RND  <=>=<>  THEN  TO 
STEP  LPRINT  LLIST  STOP  SLOU  FRST 
NEU  SCROLL  CONT  DIM  REM  FOR  GOT 
O  GOSUB  INPUT  LORD  LIST  LET  PRUS 
E  NEXT  POKE  PRINT  PLOT  RUN  SWE 


617/456-3661 


SYNTAX  QUARTERLY/SPRING  1983 


617/456-3661 


63 


li^jg  i  BOOK  REVIEW 


Inside  Story 


t  z- 

^  Ft 

f  6V* 


t- 

Title:  Secret  Guide  to  Computers 
Author:  Russ  Walter 
From:  Secret  Guide  to  Computers 
Company 

92  Saint  Botolph  St., 

Boston,  MA  02116 
617/266-8128 

Price:  $3. 70/each  or  8  vol.  set  for 
$29.60 

The  tenth  edition  of  Russ  Walter’s 
Secret  Guide  to  Computers  is  prob¬ 
ably  the  funniest,  most  interesting, 
most  entertaining  computer  learning 
guide  ever  written;  however,  it  con¬ 
tains  little  on  the  ZX/TS  computers. 
Learn  the  ZX’s  BASIC  first,  then  buy 
the  guides. 

Here’s  a  rundown  of  all  eight  vol¬ 
umes  of  the  Secret  Guide  to  Com¬ 
puters.  Volume  1  starts  the  reader  off 
with  a  lesson  on  the  keyboard  then 
proceeds  to  fixing  mistakes,  math, 
variables,  input,  program  storage, 
logic,  and  all  the  other  necessities  so 
you  can  get  started  with  BASIC  on 
most  micros,  some  minis,  and  some 
maxis. 

Deeper  into  BASIC 

Volume  2  digs  deeper  into  BASIC.  It 
includes  information  on  ON .  .  . 
GOTO  and  ON...GOSUB  state¬ 
ments  (something  the  ZXs  don’t 
have),  error  handling,  error  trapping, 
simpleton  graphics,  advanced  funda¬ 
mentals,  programming  style,  math 
functions,  sorting,  and  text  files.  This 
volume  is  the  most  helpful  for  ZX 
users  since  neither  the  ZX80  nor  the 
ZX81  manual  mention  anything 
about  graphics,  fundamentals,  or 
style  and  sorting. 

Volume  3  covers  hardware,  buying 
a  computer,  computer  companies, 
peripherals,  explanation  of  the  Cen¬ 
tral  Processing  Unit  (CPU) ,  and  a  run¬ 
down  of  the  major  microcomputers. 

The  Computer  Field  and 
Basic  Applications 

Volume  4  digs  deep  into  the  com¬ 
puter  field.  It  rehashes  the  major 
microcomputer  manufacturers,  and 
goes  over  the  major  points  of  buying 
a  big  computer.  This  volume  also 
covers  the  different  number  systems, 


getting  a  job  in  the  computer  field, 
what  to  read,  and  computer  courses 
offered  by  the  author. 

Volume  5  covers  some  basic  appli¬ 
cations.  For  example:  games,  exten¬ 
sive  graphics,  and  the  all-important 
VISICALC  and  its  mates  SUPER¬ 
CALC,  SPECTACULATOR,  and 
word  processing  in  most  micros. 

Volume  6  isn’t  available  but  I  con¬ 
tacted  the  author  who  said  it  will 
cover  artificial  intelligence  and  ex¬ 
pand  on  Volume  5. 

Volume  7  covers  FORTRAN, 
PASCAL,  COBOL  and  Volume  8 
goes  into  an  extensive  overview  of  all 
the  computer  languages  but  doesn’t 
teach  you  how  to  use  them.  Volume 
8  also  goes  into  the  history  of  the 
CPU  and  how  to  program  in  assem¬ 
bly  language  for  most  of  the  CPUs. 
Yet,  I  suggest  buying  Dr.  Ian  Logan’s 
book  written  especially  for  the  ZXs 
because  Volume  8  doesn’t  tell  you 
how  to  go  about  assembling.  It  just 
explains  various  mnemonics. 

Overall,  Russ  Walter’s  eight- 
volume  guide  is  both  fun  and  very  in¬ 
formative.  Most  computer  books  are 
too  technical,  but  the  Secret  Guide  is 
written  in  plain  English. 

Peter  Nichols,  Hanover,  MA 


Ad  Index 


Brainchild  Computer  Works  52 

Byte- Back  Co.  58 

Compuwiz  Software  36 

Dallas  Development  21 

Down  East  Computers  56 

E-Z  Key  37 

Ezra  Group  II  36 

Frog  Software  64 

General  Systems  Consulting  23 

Gladstone  Electronics  13 

M.C.  Hoffman  56 

Innovation  Company  C3 

Intercomputer,  Inc.  17 

International  Publishing  &  Software  1 
JK  Audio  56 

Kopak  Creations,  Inc.  C4 

Melbourne  House  Software  33 

Memotech  Corporation  7 

Mindware,  Inc.  C2 

Sinware  6 

Softsync,  Inc.  18 

Syntax/SQ  3,  16,  62,  63 

Tom  Woods  64 

Z-Ware  64 


Z-Ware  Sale 

ZX81  /TS-1 000  Software  on 

Cassette 

$8.95  each  ppd. 

1 6K  Histogram — plots  bar  chart 
1 6K  Financial  Manager— for 
home  or  business 
16K  Machine  Intelligence 
Demo — life  forms  that  actually 
learn. 

Many  more  available — send 
self-addressed,  stamped  en¬ 
velope. 

Z-Ware 
Box  111 

Albany,  Kentucky  42602 
1-606-387-8391 


LEARN  TO 
PROGRAM 

Text  and  File  Organizers  with 

ZX  DATA  FINDER 

A  high  capacity  information 
storage  and  retrieval  tool  for 
16  K  Timex  and  Sinclair  Com¬ 
puters. 

Advanced  file  input  and  editing 
routines  are  thoroughly 
analyzed. 

Comprehensive  search  and 
display  methods  are  fully 
explained. 

AN  ADVANCED  COURSE 
IN  DATA  HANDLING 

Free  specifications  are 
available,  or  send  $9.95  for 
program  listing  and  text  to: 

THOMAS  B.  WOODS 

P.O.  Box  64,  Jefferson,  N.H.  03583 


ARTIFICIAL  INTELLIGENCE 
FOR  THE  ZX81? 

YES! 

SYNCZX  is  an  artificial  intelligence 
program  with  natural  language  capabili¬ 
ties  for  the  ZX81  with  16K  RAM,  avail¬ 
able  from  Frog  Software. 

SYNCZX  will  talk  to  you  in  ENGLISH/ 
NO  MENUS.  You  can  use  SYNCZX  to 
balance  your  checkbook  or  you  can 
reprogram  SYNCZX  to  do  anything  you 
would  like.  However  you  do  not  need  pro¬ 
gramming  skills  to  use  SYNCZX  as  is. 
Even  a  child  can  use  SYNCZX  because  it 
is  easy  to  read  and  understand,  talking 
to  you  in  simple  English.  SYNCZX  even 
remembers  the  people  who  use  it!  16K 
cassette  with  manual  only  $6.95  plus 
$1.50  postage  &  handling. 

Frog  Software 

Box  95 

Glenmont,  New  York  12077 
(518)  465-6552 


64 


SYNTAX  QUARTERLY/SPRING  1983